您认为以下配置有意义吗?BONDTING_OPT
VLAN接口支持吗?我想确保当上游设备关闭时我的接口能够进行故障转移。
ifcfg-bond0
$ 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
答案1
您需要配置设备,然后配置绑定,最后配置 VLAN 配置文件。您还必须注意哪些属性在哪里起作用,例如bonding_opts,它只能在绑定本身中,而不是VLAN配置文件中,因为VLAN文件无法直接访问以太网连接。
我还找到了这个 RHEL 6 文档,对其进行了更多解释。对于 RHEL 7 / CentOS 7 来说,它仍然非常可靠。
添加:
绑定负责管理绑定使用的物理连接。 VLAN 对物理连接不可见,如下面的驱动程序输出所示;他们只能看到负责他们的设备,在本例中为 bond0。
这里也解释一下另一个观点: 绑定和主要虚拟 IP 地址和 VLAN 标记答案
笔记:
- 我知道这可以工作,因为我已经在 RHEL 7 系统上工作了。
- 如果您需要更多 VLAN,只需
cp ifcfg-bond0.20 ifcfg-bond0.30
更新所需字段即可。
图表:
eth0 vlan1
\ /
bond0 -vlan2
/ \
eth1 vlan3
例子:
[工作配置]
==> 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: