802.1Q VLAN很早就被納入kernel中,而MAC-VLAN在2.6.29版時納入。在編譯kernel時,需要將VLAN編譯進去,接著就可以透過vconfig/ip進行操作,不過建議使用ip。
ip
Usage: ip link add link DEV [ name ] NAME [ txqueuelen PACKETS ] [ address LLADDR ] [ broadcast LLADDR ] [ mtu MTU ] type TYPE [ ARGS ] ip link delete DEV type TYPE [ ARGS ] ip link set DEVICE [ { up | down } ] [ arp { on | off } ] [ dynamic { on | off } ] [ multicast { on | off } ] [ allmulticast { on | off } ] [ promisc { on | off } ] [ trailers { on | off } ] [ txqueuelen PACKETS ] [ name NEWNAME ] [ address LLADDR ] [ broadcast LLADDR ] [ mtu MTU ] [ netns PID ] [ alias NAME ] ip link show [ DEVICE ] TYPE := { vlan | veth | dummy | ifb | macvlan }
vconfig
Usage: add [interface-name] [vlan_id] rem [vlan-name] set_dflt [interface-name] [vlan_id] add_port [port-name] [vlan_id] rem_port [port-name] [vlan_id] set_egress_map [vlan-name] [skb_priority] [vlan_qos] set_ingress_map [vlan-name] [skb_priority] [vlan_qos] set_name_type [name-type] set_bind_mode [bind-type]
對於VLAN Net Device的命名規則則有四種:
- VLAN_PLUS_VID (vlan0005)
- VLAN_PLUS_VID_NO_PAD (vlan5)
- DEV_PLUS_VID (eth0.0005)
- DEV_PLUS_VID_NO_PAD (eth0.5)
double-tag
所謂的double tag,就是在vlan上,再切vlan,所以在linux的指令也就是vconfig add <vlan_netdev> <vid>。
參考資料:
http://www.candelatech.com/~greear/vlan.html
沒有留言:
張貼留言