我有一台旧的 Dell R620,配有双 10GbE 卡并安装了 Ubuntu 20.04。 Cockpit 和 Cockpit-Machines 已安装(安装 qeum-kvm)。网络是使用 netplan 设置的。我是 Ubuntu 的新手。
我当前的设置是:
Router (192.168.1.1) - [Ubuntu Server 20.04] KVM Host (192.168.1.110)
- [Ubuntu Server 20.04] VM1 (191.168.1.103)
在遵循无数指南之后,我终于有了一个桥接的绑定接口。 KVM 主机和 VM 可以从路由器获取 IP,但 VM 无法使用名称从外部 ping 通(DNS 出现问题)。 KVM 主机可以 ping 通“google.ca”和“8.8.8.8”。虚拟机不能ping 'google.ca' 但是能ping“8.8.8.8”。我是否从 netplan 文件中遗漏了其他内容? DNS 是否无法通过桥接和绑定接口正常工作?
以下是 KVM 主机的网络规划:
# This is the network config written by 'subiquity'
network:
renderer: NetworkManager
ethernets:
eno1:
dhcp4: false
dhcp6: false
eno2:
dhcp4: false
dhcp6: false
eno3:
dhcp4: false
dhcp6: false
eno4:
dhcp4: false
dhcp6: false
enp66s0f0:
dhcp4: false
dhcp6: false
enp66s0f1:
dhcp4: false
dhcp6: false
bonds:
bond0:
interfaces: [enp66s0f0,enp66s0f1]
dhcp4: false
dhcp6: false
parameters:
mode: balance-tlb
bridges:
br0:
interfaces: [bond0]
dhcp4: true
dhcp6: false
parameters:
stp: false
forward-delay: 0
version: 2
KVM 主机上“ip a”的输出:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether b8:ca:3a:f7:2f:96 brd ff:ff:ff:ff:ff:ff
3: enp66s0f0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
link/ether 00:0e:1e:9e:2c:82 brd ff:ff:ff:ff:ff:ff
4: enp66s0f1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
link/ether 00:0e:1e:9e:2c:80 brd ff:ff:ff:ff:ff:ff
5: eno2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether b8:ca:3a:f7:2f:97 brd ff:ff:ff:ff:ff:ff
6: eno3: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether b8:ca:3a:f7:2f:98 brd ff:ff:ff:ff:ff:ff
7: eno4: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether b8:ca:3a:f7:2f:99 brd ff:ff:ff:ff:ff:ff
9: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:0e:1e:9e:2c:80 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.110/24 brd 192.168.1.255 scope global dynamic noprefixroute br0
valid_lft 52933sec preferred_lft 52933sec
10: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP group default qlen 1000
link/ether 00:0e:1e:9e:2c:80 brd ff:ff:ff:ff:ff:ff
从 KVM 主机 ping 到 VM:
PING 192.168.1.103 (192.168.1.103) 56(84) bytes of data.
64 bytes from 192.168.1.103: icmp_seq=1 ttl=64 time=0.322 ms
64 bytes from 192.168.1.103: icmp_seq=2 ttl=64 time=0.294 ms
64 bytes from 192.168.1.103: icmp_seq=3 ttl=64 time=0.285 ms
64 bytes from 192.168.1.103: icmp_seq=4 ttl=64 time=0.294 ms
^C
--- 192.168.1.103 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3067ms
rtt min/avg/max/mdev = 0.285/0.298/0.322/0.013 ms
从 KVM 主机 Ping 到外部(名称):
PING google.ca (142.251.33.67) 56(84) bytes of data.
64 bytes from sea09s28-in-f3.1e100.net (142.251.33.67): icmp_seq=1 ttl=118 time=19.7 ms
64 bytes from sea09s28-in-f3.1e100.net (142.251.33.67): icmp_seq=2 ttl=118 time=20.3 ms
64 bytes from sea09s28-in-f3.1e100.net (142.251.33.67): icmp_seq=3 ttl=118 time=20.1 ms
64 bytes from sea09s28-in-f3.1e100.net (142.251.33.67): icmp_seq=4 ttl=118 time=19.9 ms
^C
--- google.ca ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 19.726/20.003/20.281/0.218 ms
从 KVM 主机 Ping 到外部 (IP):
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=22.7 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=119 time=22.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=119 time=22.9 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=119 time=22.9 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3006ms
rtt min/avg/max/mdev = 22.712/22.811/22.890/0.072 ms
这是 VM 上 netplan 的输出:
# This is the network config written by 'subiquity'
network:
ethernets:
enp1s0:
dhcp4: true
version: 2
这是虚拟机上“ip a”的输出:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:ad:6a:d4 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.103/24 brd 192.168.1.255 scope global dynamic enp1s0
valid_lft 86357sec preferred_lft 86357sec
inet6 fe80::5054:ff:fead:6ad4/64 scope link
valid_lft forever preferred_lft forever
从 VM ping 到 KVM 主机:
PING 192.168.1.110 (192.168.1.110) 56(84) bytes of data.
64 bytes from 192.168.1.110: icmp_seq=1 ttl=64 time=0.215 ms
64 bytes from 192.168.1.110: icmp_seq=2 ttl=64 time=0.249 ms
64 bytes from 192.168.1.110: icmp_seq=3 ttl=64 time=0.242 ms
64 bytes from 192.168.1.110: icmp_seq=4 ttl=64 time=0.241 ms
^C
--- 192.168.1.110 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3053ms
rtt min/avg/max/mdev = 0.215/0.236/0.249/0.012 ms
从虚拟机 ping 到路由器:
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=1.79 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.938 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.874 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.866 ms
^C
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 0.866/1.118/1.794/0.391 ms
从虚拟机 ping 到外部(名称):
ping: google.ca: Temporary failure in name resolution
从虚拟机 ping 到外部 (IP):
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=23.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=119 time=22.9 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=119 time=23.5 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=119 time=22.5 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 22.544/23.008/23.468/0.344 ms