Bridging on Debian GNU/Linux
在Debian/Ubuntu裡想要啟用bridge(IEEE 802.1d)功能,必須要先安裝bridge-utils套件;假設你已經安裝了KVM/XEN,那麼bridge-utils則早就安裝完畢。
假設現在要把eth0設定成bridge,作為VM與外部溝通的管道:
auto lo iface lo inet loopback auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address 192.168.10.198 netmask 255.255.255.0 gateway 192.168.10.1 up sleep 3; ethtool -s br0 autoneg off speed 1000 duplex full bridge_ports bond0 bridge_fd 0 #forward delay=0s bridge_hello 2 #say hello time=2s bridge_maxage 12 #maximum message age bridge_stp on #啟用STP
請注意這裡關於eth0的宣告只能使用manual!重新啟動網路後,看看裡頭的資訊吧!
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP qlen 1000 link/ether f4:6d:04:7b:be:13 brd ff:ff:ff:ff:ff:ff 3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP link/ether f4:6d:04:7b:be:13 brd ff:ff:ff:ff:ff:ff inet 192.168.10.198/24 brd 192.168.10.255 scope global br0 inet6 fe80::f66d:4ff:fe7b:be13/64 scope link valid_lft forever preferred_lft forever 4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN link/ether ca:f4:7c:0b:34:1f brd ff:ff:ff:ff:ff:ff inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
Bridge on bonding
延續先前bonding的設定,我們把bond0設定成bridge:
auto eth0
iface eth0 inet manual
bond-master bond0
auto eth1
iface eth1 inet manual
bond-master bond0
auto bond0
iface bond0 inet manual
# address 192.168.10.198
# netmask 255.255.255.0
# gateway 192.168.10.1
bond-slaves eth0 eth1
bond-mode 5
bond-miimon 100
bond-downdelay 200
bond-updelay 200
auto br0
iface br0 inet static
address 192.168.10.22
netmask 255.255.255.0
gateway 192.168.10.1
bridge_ports bond0
bridge_stp off
當然你想設定DHCP也行!別忘了重新啟動網路吧!
invoke-rc.d networking restart
參考文章:
Share |
沒有留言:
張貼留言