我在 ubuntu 18.04 中设置了 2 个设备的结合。
看起来 bond0 正在启动并且我可以 ping 它,但是物理接口也从我的 DHCP 服务器获得了一个 IP 地址。
接口 enp3s0 和 bond0 的 IP 地址在同一范围内,这会导致麻烦。
有什么想法我的配置有什么问题吗?
我的 netplan 配置:
network:
version: 2
renderer: networkd
ethernets:
enp2s0:
dhcp4: false
dhcp6: false
enp3s0:
dhcp4: false
dhcp6: false
bonds:
bond0:
interfaces:
- enp2s0
- enp3s0
parameters:
mode: 0
addresses: [192.168.88.8/24]
gateway4: 192.168.88.1
nameservers:
search: [lan]
addresses: [127.0.0.1, 192.168.88.1]
应用配置后,设备上的 IP 地址如下所示:
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet **192.168.88.8** netmask 255.255.255.0 broadcast 192.168.88.255
inet6 fe80::6478:e7ff:fec9:3af4 prefixlen 64 scopeid 0x20<link>
inet6 2001:16b8:42d:e200:81e2:eb92:f8ac:5c22 prefixlen 64 scopeid 0x0<global>
inet6 2001:16b8:42d:e200:6478:e7ff:fec9:xxxx prefixlen 64 scopeid 0x0<global>
ether 66:78:e7:xx:xx:xx txqueuelen 1000 (Ethernet)
RX packets 16003 bytes 2905996 (2.9 MB)
RX errors 0 dropped 1280 overruns 0 frame 0
TX packets 12699 bytes 2546657 (2.5 MB)
TX errors 0 dropped 18 overruns 0 carrier 0 collisions 0
enp2s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
inet 169.254.229.33 netmask 255.255.0.0 broadcast 169.254.255.255
ether 66:78:e7:xx:xx:xx txqueuelen 1000 (Ethernet)
RX packets 13819 bytes 2678515 (2.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11456 bytes 2425479 (2.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp3s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
inet **192.168.88.193** netmask 255.255.255.0 broadcast 192.168.88.255
ether 66:78:e7:xx:xx:xx txqueuelen 1000 (Ethernet)
RX packets 2184 bytes 227481 (227.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1243 bytes 121178 (121.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Lokale Schleife)
RX packets 2793 bytes 302214 (302.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2793 bytes 302214 (302.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@gemini:/etc/netplan# netplan --debug generate
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:15612): DEBUG: 19:42:50.224: Processing input file /etc/netplan/01-netcfg.yaml..
** (generate:15612): DEBUG: 19:42:50.227: starting new processing pass
** (generate:15612): DEBUG: 19:42:50.227: enp3s0: setting default backend to 1
** (generate:15612): DEBUG: 19:42:50.227: Configuration is valid
** (generate:15612): DEBUG: 19:42:50.227: enp2s0: setting default backend to 1
** (generate:15612): DEBUG: 19:42:50.227: Configuration is valid
** (generate:15612): DEBUG: 19:42:50.227: bond0: setting default backend to 1
** (generate:15612): DEBUG: 19:42:50.227: Configuration is valid
** (generate:15612): DEBUG: 19:42:50.227: Generating output files..
** (generate:15612): DEBUG: 19:42:50.228: NetworkManager: definition enp2s0 is not for us (backend 1)
** (generate:15612): DEBUG: 19:42:50.228: NetworkManager: definition enp3s0 is not for us (backend 1)
** (generate:15612): DEBUG: 19:42:50.228: NetworkManager: definition bond0 is not for us (backend 1)
root@gemini:/mnt/extdisk/B# sudo lshw -C network
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:02:00.0
logical name: enp2s0
version: 06
serial: 66:78:e7:c9:3a:f4
size: 1Gbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168e-3_0.0.4 03/27/12 ip=169.254.229.33 latency=0 link=yes multicast=yes port=MII slave=yes speed=1Gbit/s
resources: irq:17 ioport:e000(size=256) memory:b0804000-b0804fff memory:b0800000-b0803fff
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:03:00.0
logical name: enp3s0
version: 11
serial: 66:78:e7:c9:3a:f4
size: 10Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half firmware=rtl8168g-2_0.0.1 02/06/13 latency=0 link=no multicast=yes port=MII slave=yes speed=10Mbit/s
resources: irq:18 ioport:d000(size=256) memory:b0704000-b0704fff memory:b0700000-b0703fff
*-network
description: Ethernet interface
physical id: 1
logical name: bond0
serial: 66:78:e7:c9:3a:f4
size: 1Gbit/s
capabilities: ethernet physical
configuration: autonegotiation=off broadcast=yes driver=bonding driverversion=3.7.1 duplex=full firmware=2 ip=192.168.88.8 link=yes master=yes multicast=yes speed=1Gbit/s
替代配置
root@gemini:/etc/netplan# cat 01-netcfg.yaml
network:
bonds:
bond0:
addresses: [192.168.88.8/24]
gateway4: 192.168.88.1
nameservers:
addresses: [127.0.0.1, 192.168.88.1]
interfaces:
- enp2s0
- enp3s0
ethernets:
enp2s0:
dhcp4:false
enp3s0:
dhcp4:false
root@gemini:/etc/netplan# netplan apply
/etc/netplan/01-netcfg.yaml:10:17: Error in network definition: bond0: interface 'enp3s0' is not defined
- enp3s0
^
root@gemini:/etc/netplan#