Linux
Linux 綁定與 VLAN 問題
您認為以下配置有意義嗎?
BONDTING_OPT
VLAN介面是否支持?我想確保我的介面在上游設備關閉時故障轉移。ifcfg-債券0
$ cat /etc/sysconfig/network-scripts/ifcfg-bond0 NAME=bond0 DEVICE=bond0 BOOTPROTO=none ONBOOT=yes BONDING_OPTS="mode=1 miimon=500 downdelay=1000 primary=eno1 primary_reselect=always"
ifcfg-bond0.10
$ cat /etc/sysconfig/network-scripts/ifcfg-bond0.10 NAME=bond0.10 DEVICE=bond0.10 ONPARENT=yes BOOTPROTO=dhcp VLAN=yes BONDING_OPTS="mode=1 arp_interval=1000 arp_ip_target=10.10.0.1 miimon=500 downdelay=1000 primary=eno1 primary_reselect=always" NM_CONTROLLED=no
ifcfg-bond0.20
$ cat /etc/sysconfig/network-scripts/ifcfg-bond0.20 NAME=bond0.20 DEVICE=bond0.20 ONPARENT=yes BOOTPROTO=dhcp VLAN=yes BONDING_OPTS="mode=1 arp_interval=1000 arp_ip_target=74.xx.xx.1 miimon=500 downdelay=1000 primary=eno1 primary_reselect=always" NM_CONTROLLED=no
您需要配置設備,然後是綁定,最後是 VLAN 配置文件。您還必須注意哪些屬性在哪裡起作用,例如bonding_opts,它只能在綁定中,而不是VLAN配置文件,因為VLAN文件將無法直接訪問乙太網連接。
我還發現了這個 RHEL 6 文件,它對此進行了更多解釋。對於 RHEL 7 / CentOS 7,它仍然非常可靠。
添加:
綁定負責管理綁定使用的物理連接。VLAN 無法看到物理連接,如下面的驅動程序輸出所示;他們只看到對他們負責的設備,在這種情況下是bond0。
這裡還解釋了另一種觀點: bonded-and-primary-virtual-ip-addresses-and-vlan-tagged Answer
筆記:
- 我知道這很有效,因為我讓它在 RHEL 7 系統上工作。
- 如果您需要更多 VLAN,只需
cp ifcfg-bond0.20 ifcfg-bond0.30
更新必填欄位。圖表:
eth0 vlan1 \ / bond0 -vlan2 / \ eth1 vlan3
例子:
$$ Working config $$
==> ifcfg-eth0 <== DEVICE=eth0 NAME=bond0-slave HWADDR=xx:xx:xx:xx:xx:xx ONBOOT=yes BOOTPROTO=none MASTER=bond0 SLAVE=yes USERCTL=no NM_CONTRLLED=no ==> ifcfg-eth1 <== DEVICE=eth1 NAME=bond0-slave HWADDR=xx:xx:xx:xx:xx:xx ONBOOT=yes BOOTPROTO=none MASTER=bond0 SLAVE=yes USERCTL=no NM_CONTRLLED=no ==> ifcfg-bond0 <== DEVICE=bond0 TYPE=bond BONDING_MASTER=yes NAME=bond0 ONBOOT=yes BONDING_OPTS="miimon=100 mode=active-backup" ==> ifcfg-bond0.10 <== VLAN=yes TYPE=vlan DEVICE=bond0.10 PHYSDEV=bond0 VLAN_ID=10 BOOTPROTO=none NAME=bond0.10 ONBOOT=yes IPADDR=x.x.x.x PREFIX=24 GATEWAY=x.x.x.1 IPV6INIT=no DEFROUTE=yes ==> ifcfg-bond0.20 <== VLAN=yes TYPE=vlan DEVICE=bond0.20 PHYSDEV=bond0 VLAN_ID=20 BOOTPROTO=none NAME=bond0.20 ONBOOT=yes IPADDR=x.x.x.x PREFIX=24 GATEWAY=x.x.x.1 IPV6INIT=no DEFROUTE=no
正在使用的驅動程序:
[thebtm@server network-scripts]$ sudo cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup) Primary Slave: None Currently Active Slave: eth0 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth0 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: xx:xx:xx:xx:xx:xx Slave queue ID: 0 Slave Interface: eth1 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: xx:xx:xx:xx:xx:xx Slave queue ID: 0 [thebtm@server network-scripts]$ sudo cat /proc/net/vlan/bond0.10 bond0.10 VID: 10 REORDER_HDR: 1 dev->priv_flags: 1 total frames received 29091167441 total bytes received 139953896100912 Broadcast/Multicast Rcvd 18 total frames transmitted 21506143557 total bytes transmitted 14822425401382 Device: bond0 INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: [thebtm@server network-scripts]$ sudo cat /proc/net/vlan/bond0.20 bond0.20 VID: 20 REORDER_HDR: 1 dev->priv_flags: 1 total frames received 2637498 total bytes received 290061293 Broadcast/Multicast Rcvd 5 total frames transmitted 6 total bytes transmitted 252 Device: bond0 INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: