Setting up VLAN on SuSE Linux manually
請先確定SuSE上已經安裝了vconfig套件,並且8021q模組已被啟用:
zypper install vconfig假設eth0的網路是192.168.10.0/24,而switch上另外有兩個VLAN,分別是VLAN5(192.168.100.0/24)/VLAN10(192.168.200.0/24),希望同時能跟這兩個VLAN的網路溝通:
modprobe 8021q
ifcfg-eth0 | ifcfg-vlan5 | ifcfg-vlan10 |
---|---|---|
BOOTPROTO='static' STARTMODE='auto' IPADDR='192.168.10.198/24' GATEWAY='192.168.10.1' USERCONTROL='no' |
BOOTPROTO='static' ETHERDEVICE='eth0' IPADDR='192.168.100.2/24' GATEWAY='192.168.100.254' STARTMODE='auto' USERCONTROL='no' VLAN_ID='5' |
BOOTPROTO='static' ETHERDEVICE='eth0' IPADDR='192.168.200.2/24' GATEWAY='192.168.200.254' STARTMODE='auto' USERCONTROL='no' VLAN_ID='10' |
延續之前的設定:我們已經把eth0/eth1結合成bond0,現在我們又要為bond0加上VLAN tag:vlan5/vlan10。
ifcfg-eth0 | ifcfg-eth1 | ifcfg-bond0 | ifcfg-vlan5 | ifcfg-vlan10 |
---|---|---|---|---|
BOOTPROTO='none' STARTMODE='auto' USERCONTROL='no' |
BOOTPROTO='none' STARTMODE='auto' USERCONTROL='no' |
BONDING_MASTER='yes'
BONDING_MODULE_OPTS='mode=6 miimon=100'
BONDING_SLAVE0='eth0'
BONDING_SLAVE1='eth1'
BOOTPROTO='static'
IPADDR='192.168.10.99/24'
GATEWAY='192.168.10.1'
STARTMODE='auto'
USERCONTROL='no'
|
BOOTPROTO='static' ETHERDEVICE='bond0' IPADDR='192.168.200.2/24' GATEWAY='192.168.200.254' STARTMODE='auto' USERCONTROL='no' VLAN_ID='5' |
BOOTPROTO='static' ETHERDEVICE='bond0' IPADDR='192.168.200.2/24' GATEWAY='192.168.200.254' STARTMODE='auto' USERCONTROL='no' VLAN_ID='10' |
cat /proc/net/vlan/config
VLAN Dev name | VLAN ID Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD vlan10 | 10 | bond0 vlan5 | 5 | bond0
cat /proc/net/vlan/vlan10
vlan10 VID: 10 REORDER_HDR: 1 dev->priv_flags: 1 total frames received 0 total bytes received 0 Broadcast/Multicast Rcvd 0 total frames transmitted 7 total bytes transmitted 578 Device: bond0 INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings:
延續之前的設定:我們已經把eth0/eth1結合成bond0,又在分享了bond0成為br0;現在我們又要為br0加上VLAN tag:vlan5/vlan10。
ifcfg-eth0 | ifcfg-eth1 | ifcfg-bond0 | ifcfg-br0 | ifcfg-vlan5 | ifcfg-vlan10 |
---|---|---|---|---|---|
BOOTPROTO='none' STARTMODE='auto' USERCONTROL='no' |
BOOTPROTO='none' STARTMODE='auto' USERCONTROL='no' |
BONDING_MASTER='yes' BONDING_MODULE_OPTS='mode=5 miimon=100' BONDING_SLAVE0='eth0' BONDING_SLAVE1='eth1' BOOTPROTO='static' IPADDR='0.0.0.0/32' STARTMODE='auto' USERCONTROL='no' |
BOOTPROTO='static' BRIDGE='yes' IPADDR='192.168.10.99/24' GATEWAY='192.168.10.1' BRIDGE_FORWARDDELAY='0' BRIDGE_PORTS='bond0' BRIDGE_STP='on' STARTMODE='auto' USERCONTROL='no' |
BOOTPROTO='static' ETHERDEVICE='br0' IPADDR='192.168.100.2/24' STARTMODE='auto' USERCONTROL='no' VLAN_ID='5' |
BOOTPROTO='static' ETHERDEVICE='br0' IPADDR='192.168.200.2/24' STARTMODE='auto' USERCONTROL='no' VLAN_ID='10' |
當然如果switch有設定VLAN DHCP服務的話,這裡設定DHCP也行!別忘了重新啟動網路吧!
rcnetwork restart
Setting up VLAN on SuSE Linux by Yast2
我說不出我對於yast有多麼的崇敬,SuSE的yast真的可以說是系統管理工具的楷模,我深信所以試圖寫出比yast更優秀工具的工程師也會覺得黔驢技窮。
在Yast2 -> Network Device裡,可以新增一個網路裝置。 | |
選擇建立VLAN並設定vlan ID。 | |
選擇使用VLAN的實體界面(此例是以bond0為Real Interface,也可以是br0),並設定IP位址。 | |
按下OK就完成了,VLAN10也是如法泡製!非常帥氣的Yast!!! |
Share |
沒有留言:
張貼留言