For When You Can't Have The Real Thing
[ start | index | login ]
start > RedHat > VLAN definition

VLAN definition

Created by dave. Last edited by dave, 9 years and 292 days ago. Viewed 7,260 times. #3
[diff] [history] [edit] [rdf]
labels
attachments

VLAN Configuration

(>>Source)

My VLAN ID is 5. So I need to copy file /etc/sysconfig/network-scripts/ifcfg-eth0 to /etc/sysconfig/network-scripts/ifcfg-eth0.5

# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.5
So I have one network card (eth0) and it needs to use tagged network traffic for VLAN ID 5.

Above files will configure Linux system to have:

  • eth0 - Your regular network interface
  • eth0.5 - Your virtual interface that use untagged frames
Do not modify /etc/sysconfig/network-scripts/ifcfg-eth0 file. Now open file /etc/sysconfig/network-scripts/ifcfg-eth0.5 using vi text editor:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0.5
Find DEVICE=ifcfg-eth0line and replace with:
DEVICE=ifcfg-eth0.5
Append line:
VLAN=yes
Also make sure you assign correct IP address using DHCP or static IP. Save the file. Remove gateway entry from all other network config files. Only add gateway to /etc/sysconfig/network file.

Restart network:

# /etc/init.d/network restart
Please note that if you need to configure for VLAN ID 2 then copy the copy file /etc/sysconfig/network-scripts/ifcfg-eth0 to /etc/sysconfig/network-scripts/ifcfg-eth0.2 and do the above procedure again.

Here's a sample (ifcfg-eth1.201 in this case):

DEVICE=eth1.201
HWADDR=00:11:43:CD:81:FB
TYPE=Ethernet
VLAN=yes
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.126.1.254
NETMASK=255.255.255.0

Doing It Old-School

If you want to define the interface and bring it up without applying an IP to it (for example, if you have a complicated sniffing environment), you have to define the VLAN manually then bring the interface up manually:

# vconfig add eth2 1234
# ifconfig eth2.1234 up
You can now run a packet sniffer on that interface in promiscuous mode.

no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt