Bridging on Redhat Linux
Redhat Linux裡想要啟用bridge(IEEE 802.1d)功能,必須要先安裝bridge-utils套件;如果系統裡可以執行brctl這個指令,那麼你的系統已經可以建立bridge了。
假設現在要把eth0設定成bridge分享給VM作為與外部溝通的管道:
ifcfg-eth0 | ifcfg-br0 |
---|---|
DEVICE=eth0 BRIDGE=br0 BOOTPROTO=static ONBOOT=yes USERCTL=no NM_CONTROLLED=no |
DEVICE=br0 TYPE=Bridge ONBOOT=yes BOOTPROTO=static IPADDR=192.168.10.22 NETMASK=255.255.255.0 GATEWAY=192.168.10.1 USERCTL=no NM_CONTROLLED=no |
請注意這裡關於eth0只有啟用,並沒有賦予其他設定!重新啟動網路後,看看裡頭的資訊吧!
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.22/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:
ifcfg-eth0 | ifcfg-eth1 | ifcfg-bond0 | ifcfg-br0 |
---|---|---|---|
DEVICE=eth0
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no |
DEVICE=eth1
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no |
DEVICE=bond0
TYPE=bonding
BRIDGE=br0
BOOTPROTO=static
# IPADDR=192.168.10.198
# NETMASK=255.255.255.0
# GATEWAY=192.168.10.1
# MTU=5000
ONBOOT=yes
USERCTL=no
NM_CONTROLLED=no
BONDING_OPTS="mode=6 miimon=100
HOTPLUG=no
|
DEVICE=br0 TYPE=Bridge ONBOOT=yes BOOTPROTO=static IPADDR=192.168.10.22 NETMASK=255.255.255.0 GATEWAY=192.168.10.1 |
當然你想設定DHCP也行!別忘了重新啟動網路吧!
service network restart
參考文章:
Share |
沒有留言:
張貼留言