Red Hat, OEL 5,6 vlan tagging

Red Hat, OEL 5,6 vlan tagging

vlan tagging can only be set up on a virtual interface, and the 8021q driver must be present

For this document we will use the following addresses

Physical: 172.22.130.80 255.255.254.0 gateway: 172.22.130.1
Virtual: 192.168.72.11 255.255.255.0 gateway: 192.168.72.2 vlan: 4

1. First check if the 8021q driver is installed

# lsmod | grep 8021q
#
Nope, not there, so we install it

# modprobe 8021q
# lsmod | grep 8021q
8021q 21088 0
garp 6692 1 8021q
#

2. now for the physical device
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet
DEVICE=eth0
BOOTPROTO=none
#HWADDR=00:1E:C9:3C:93:78
ONBOOT=yes
IPADDR=172.22.130.80
NETMASK=255.255.254.0
GATEWAY=172.22.130.1
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes

3. create a second ifcfg file using device.vlan

# cat /etc/sysconfig/network-scripts/ifcfg-eth0.4
# Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet
DEVICE=eth0.4
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.72.11
NETMASK=255.255.255.0
GATEWAY=192.168.72.2
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
vlan=yes

Make sure you have the tag "vlan=yes" and that there is no HWADDR tag

4. Add the driver to the tcp/ip stack with vconfig (vconfig add device vlan)

# vconfig add eth0 4

5. routing. Linux sets as default the first gateway that connects. In this example we set the
first gateway in /etc/sysconfig/network-scripts/ifcfg-eth0 (GATEWAY=172.22.130.1). But we have
to set up a persistant route (lives after reboot) so that traffic goes where it needs to go. So
we create a persistant route file.

# cat /etc/sysconfig/network-scripts/route-eth0
default via 172.22.130.1 dev eth0
172.0.0.0/8 via 172.22.130.1 dev eth0
192.168.72.0 via 192.168.72.2 dev eth0.4
#

6. restart networking

# service network restart

7. check our routing tables

# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.72.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0.4
172.22.130.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0.4
172.0.0.0 172.22.130.1 255.0.0.0 UG 0 0 0 eth0
0.0.0.0 192.168.72.2 0.0.0.0 UG 0 0 0 eth0.4

Leave a Reply

Your email address will not be published. Required fields are marked *