Questions about this topic? Sign up to ask in the talk tab.

Linux Gateway and VLANs

From NetSec
Revision as of 19:37, 29 October 2016 by User (Talk | contribs) (Created page with "Linux Router/Gateway <-> Cisco switch <-> Hosts Debian/Ubuntu: <nowiki># Load the 802.1q kernel module modprobe 8021q # Add a new VLAN vconfig add <interface> <VLAN> vconf...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Linux Router/Gateway <-> Cisco switch <-> Hosts

Debian/Ubuntu:

# Load the 802.1q kernel module
modprobe 8021q

# Add a new VLAN vconfig add <interface> <VLAN>
vconfig add eth1 10

# Assign an IP address and network to the new interface.
ip addr add 10.0.0.1/24 dev eth1.10

# Bring the interface up.
ip link set up eth1.10

# Make changes permanent
echo "8021q" >> /etc/modules

# /etc/network/interfaces
auto eth1.10
iface eth1.10 inet static
        address 10.0.0.1
        netmask 255.255.255.0
        vlan-raw-device eth1

On the Cisco switch:

Switch> enable
Switch# config terminal
Switch(config)# interface GigabitEthernet1/0/1
Switch(if-config)# switchport trunk encapsulation dot1q
Switch(if-config)# switchport mode trunk
Switch(if-config)# switchport trunk allowed vlan 1,10
Switch(if-config)# switchport trunk native vlan 1
Switch(if-config)# end

Switch# config terminal
Switch(config)# interface vlan 10
Switch(if-config)# no shutdown
Switch(if-config)# ip address 10.0.0.254 255.255.255.0
Switch(if-config)# end
Switch# ping 10.0.0.1

If everything is configured correctly, the ping should return with a success rate of 100 percent.

Switch# config terminal
Switch(config)# interface GigabitEthernet1/0/2
Switch(if-config)# switchport access vlan 10
Switch(if-config)# end