본문 바로가기
  • AI (Artificial Intelligence)
Skills/RedHat, CentOS

Linux adding and removing vlan tagged interfaces

by 로샤스 2014. 7. 31.
In order to arrange vlan interfaces in Linux, some distros (base CentOS) need the vconfig utility:
Code:
# rpm -qa | grep vconfig
vconfig-1.9-3



Adding vlan interface in Linux:
Code:
# vconfig add eth1 10
Added VLAN with VID == 10 to IF -:eth1:-
# ip a l eth1.10
14: eth1.10@eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop 
    link/ether 00:0c:29:5a:13:77 brd ff:ff:ff:ff:ff:ff

Code:
# ip a add 192.168.10.2/24 dev eth1.10
# ifconfig eth1.10 up
## ip a l eth1.10
14: eth1.10@eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue 
    link/ether 00:0c:29:5a:13:77 brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.2/24 scope global eth1.10
    inet6 fe80::20c:29ff:fe5a:1377/64 scope link 
       valid_lft forever preferred_lft forever


To verify the eth1.10 vlan interface (tag 10), I'll do a ping in the 192.168.10.0/24 subnet and a tcpdump on the other window on the physical interface:
Code:
# ping 192.168.10.10
PING 192.168.10.10 (192.168.10.10) 56(84) bytes of data.
From 192.168.10.2 icmp_seq=2 Destination Host Unreachable
From 192.168.10.2 icmp_seq=3 Destination Host Unreachable

# tcpdump -nni eth1 -e vlan
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes
14:23:26.335853 00:0c:29:5a:13:77 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 46: vlan 10, p 0, ethertype ARP, arp who-has 192.168.10.10 tell 192.168.10.2
14:23:27.350607 00:0c:29:5a:13:77 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 46: vlan 10, p 0, ethertype ARP, arp who-has 192.168.10.10 tell 192.168.10.2
14:23:28.361366 00:0c:29:5a:13:77 > ff:ff:ff:ff:ff:ff, ethertype 802.1Q (0x8100), length 46: vlan 10, p 0, ethertype ARP, arp who-has 192.168.10.10 tell 192.168.10.2


Removing vlan interface in Linux:
Code:
# vconfig rem eth1.10
Removed VLAN -:eth1.10:-
# ip a l eth1.10
Device "eth1.10" does not exist.

_________________
Andrei Manescu - andrei.manescu _at_ ivorde.ro











출처 : http://forum.ivorde.ro/linux-adding-and-removing-vlan-tagged-interfaces-t15231.html










댓글