![Netplan - 在 Ubuntu 18.04 KVM 主机上桥接绑定](https://linux22.com/image/906620/Netplan%20-%20%E5%9C%A8%20Ubuntu%2018.04%20KVM%20%E4%B8%BB%E6%9C%BA%E4%B8%8A%E6%A1%A5%E6%8E%A5%E7%BB%91%E5%AE%9A.png)
我先为这篇太长的文章道歉,这让我好几天都心烦意乱。
我有一台带有 4 个 NIC(eno1、eno2、eno3、eno4)的服务器。我正在尝试建立以下设置:
Host - Ubuntu Server 18.04 running KVM {
VM1 - Webserver Ubuntu 16.04
VM2 - Fileserver Ubuntu 16.04
}
eno1:为 VM 主机访问保留(Ubuntu Server 18.04)。
eno2 -> br0:eno2 桥接至 br0,为 Web 服务器保留。
(eno3-eno4)-> br1:
eno3 和 eno4 绑定,处于 active-rr 模式,稍后桥接至 br1 作为文件服务器。
因为主机运行的是 Ubuntu Server 18.04,所以我使用 Netplan 来配置上述内容,这是我的 yaml 文件:
[根据 heynnema 的评论编辑,第 3 次修订]
network:
version: 2
renderer: networkd
ethernets:
eno1:
dhcp4: false
addresses: [10.0.0.10/24]
gateway4: 10.0.0.1
nameservers:
addresses: [10.0.0.1]
eno2:
addresses: []
dhcp4: false
eno3:
addresses: []
dhcp4: false
eno4:
addresses: []
dhcp4: false
bridges:
br0:
addresses: [10.0.0.11/24]
gateway4: 10.0.0.1
nameservers:
addresses: [10.0.0.1]
interfaces: [eno2]
br1:
addresses: [10.0.0.12/24]
gateway4: 10.0.0.1
nameservers:
addresses: [10.0.0.1]
interfaces: [bond0]
bonds:
bond0:
addresses: []
dhcp4: true
interfaces: [eno3,eno4]
parameters:
mode: active-rr
应用设置:
sudo netplan --debug generate
sudo netplan apply
ifconfig 显示: [根据 heynnema 的评论进行了更新,第三次修订]
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
ether 2a:0c:4e:3a:0d:ed txqueuelen 1000 (Ethernet)
RX packets 988 bytes 483252 (483.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 549 bytes 59611 (59.6 KB)
TX errors 0 dropped 8 overruns 0 carrier 0 collisions 0
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.11 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::dcc9:e1ff:fe34:1282 prefixlen 64 scopeid 0x20<link>
ether de:c9:e1:34:12:82 txqueuelen 1000 (Ethernet)
RX packets 149 bytes 30135 (30.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12 bytes 936 (936.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
br1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.12 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::30d6:53ff:fe76:2cdf prefixlen 64 scopeid 0x20<link>
ether 32:d6:53:76:2c:df txqueuelen 1000 (Ethernet)
RX packets 958 bytes 467860 (467.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 544 bytes 56791 (56.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.10 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::1260:4bff:fea9:428 prefixlen 64 scopeid 0x20<link>
ether 10:60:4b:a9:04:28 txqueuelen 1000 (Ethernet)
RX packets 65 bytes 7278 (7.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 16 bytes 1200 (1.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xf7f00000-f7ffffff
eno2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 10:60:4b:a9:04:29 txqueuelen 1000 (Ethernet)
RX packets 552 bytes 413409 (413.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 297 bytes 19294 (19.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xf7d00000-f7dfffff
eno3: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 2a:0c:4e:3a:0d:ed txqueuelen 1000 (Ethernet)
RX packets 476 bytes 240597 (240.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 274 bytes 26232 (26.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xf7b00000-f7bfffff
eno4: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST> mtu 1500
ether 2a:0c:4e:3a:0d:ed txqueuelen 1000 (Ethernet)
RX packets 512 bytes 242655 (242.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 275 bytes 33379 (33.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xf7900000-f79fffff
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 (Local Loopback)
RX packets 120 bytes 9408 (9.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 120 bytes 9408 (9.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:a4:a5:c2 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::fc54:ff:fee0:bf1b prefixlen 64 scopeid 0x20<link>
ether fe:54:00:e0:bf:1b txqueuelen 1000 (Ethernet)
RX packets 285 bytes 18358 (18.3 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 506 bytes 409706 (409.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
vnet1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::fc54:ff:fe79:4f63 prefixlen 64 scopeid 0x20<link>
ether fe:54:00:79:4f:63 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 145 bytes 36033 (36.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
安装第一个虚拟机(网络服务器)可以使用br0,我可以通过 ssh 登陆,而且我的路由器也承认该域。
使用文件服务器上的安装过程br1被中断,提示 dhcp 网络配置不正确。当我 ssh 进入br1,它将我连接到 VM 主机。我不确定如何告诉主机使用eno1并确认文件安装br1。