1. Connect the eth0 interface of your linux machine to the switch.
2. Remove the IP Address information on the eth0 interface
# ifconfig eth0 0.0.0.0
# ifconfig eth0 up
3. Configure 2 VLANs on the eth0 interface using vconfig as follows (100,200 are the VLAN id’s). If the 8021q.o module is not loaded, the vconfig command (when invoked first time) will automatically load the module.
# vconfig add eth0 100
# vconfig add eth0 200
4. Configure IP on the VLAN interfaces
# ifconfig eth0.100 xxx.xxx.xxx.xxx netmask 255.255.252.0 up
# ifconfig eth0.200 yyy.yyy.yyy.yyy netmask 255.255.255.0 up
5. Preserve the vlan configuration across reboots by adding it to configuration files. Create the appropriate ifcfg files for eth0, eth0.100 and eth0.200 in /etc/sysconfig/network-scripts/
# cd /etc/sysconfig/network-scripts/
Contents of ifcfg-eth0
DEVICE=eth0
ONBOOT=no
TYPE=Ethernet
Contents of ifcfg-eth0.100
DEVICE=eth0.100
IPADDR=xxx.xxx.xxx.xxx
NETMASK=255.255.252.0
VLAN=yes
ONBOOT=yes
BOOTPROTO=none
Contents of ifcfg-eth0.200
DEVICE=eth0.200
IPADDR=yyy.yyy.yyy.yyy
NETMASK=255.255.0.0
VLAN=yes
ONBOOT=yes
BOOTPROTO=none
Update /etc/sysconfig/network file to make the GATEWAYDEV use the public vlan interface.
Contents of /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=un1xf00
GATEWAY=xxx.xxx.xxx.1
DOMAINNAME=dev.un1xf00.com
GATEWAYDEV=eth0.100
6. The VLAN configuration on the server can be verified in the file /proc/net/vlan/config. Sample contents are shown below.
VLAN Dev name | VLAN ID
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
eth0.100 | 100 | eth0
eth0.200 | 200 | eth0
출처 : http://linux.cloudibee.com/2007/12/linux-vlan-configuration/
'Skills > Unix, Linux' 카테고리의 다른 글
[CentOS] Repair Mode (0) | 2014.10.16 |
---|---|
Configure Linux Virtual Local Area Network (VLAN) (0) | 2014.07.31 |
linux 브릿지 설정 brctl (1) | 2014.07.29 |
Wireshark 설치하기 (0) | 2014.07.14 |
Device eth0 does not seem to be present, delaying initialization (1) | 2014.07.09 |
댓글