我根据此网络计划在 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
答案1
小编辑...观察缩进、间距和无制表符......
network:
version: 2
renderer: networkd
ethernets:
eno1:
optional: true
enp2s0:
optional: true
bonds:
bond0:
interfaces: [en01, enp2s0]
addresses: [192.168.3.5/24]
gateway4: 192.168.3.253 # are you sure it's .253?
nameservers:
addresses: [208.67.222.222, 208.67.220.220, 8.8.8.8, 8.8.4.4]
parameters:
mode: active-backup
primary: eno1
sudo netplan --debug generate
# 生成配置文件
sudo netplan apply
# 应用配置
reboot
# 确保正常运行