我根据这个网络计划在 Ubuntu 18.04 中为故障安全设置了网络绑定:
network:
version: 2
ethernets:
eno1:
dhcp4: no
enp2s0:
dhcp4: no
bonds:
bond0:
addresses: [192.168.3.5/24]
gateway4: 192.168.3.253
nameservers:
addresses: [208.67.222.222,208.67.220.220,8.8.8.8,8.8.4.4]
dhcp4: no
interfaces:
- eno1
- enp2s0
parameters:
mode: active-backup
primary: eno1
现在,当我登录时,我得到:
IP address for enp2s0: 192.168.3.96
IP address for eno1: 192.168.3.96
IP address for bond0: 192.168.3.5
ifconfig 给了我(删节):
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet 192.168.3.5 netmask 255.255.255.0 broadcast 192.168.3.255
inet6 xxx:a31d prefixlen 64 scopeid 0x20<link>
ether xxx:a3:1d txqueuelen 1000 (Ethernet)
eno1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
inet 192.168.3.96 netmask 255.255.255.0 broadcast 192.168.3.255
ether xxx:a3:1d txqueuelen 1000 (Ethernet)
enp2s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
inet 192.168.3.96 netmask 255.255.255.0 broadcast 192.168.3.255
ether xxx:a3:1d txqueuelen 1000 (Ethernet)
我敢肯定,在设置绑定之前,两个 MAC 之一以:a3:1c
我在设置绑定时是否犯了错误,或者这是预期的行为?
编辑
我不得不重新安装,这是安装程序为我的相同配置生成的文件,包括绑定:
network:
bonds:
bond0:
addresses:
- 192.168.3.5/24
gateway4: 192.168.3.253
interfaces:
- eno1
- enp2s0
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
parameters:
mode: active-backup
ethernets:
eno1: {}
enp2s0: {}
version: 2
小修改...注意缩进、间距和没有制表符...
sudo netplan --debug generate
# 生成配置文件sudo netplan apply
# 应用配置reboot
#确保正常运行