我一直在玩 Windows Hyper-V Server 2019,基本上是在尝试创建自己的云。
奇怪的是,我无法让 Ubuntu 18.04 LTS 和 Ubuntu 16.04 LTS 直接连接到互联网。
如果我在 Hyper-V 设置中将网络连接设置为 VLAN 标记 id 2(直接连接到我的调制解调器的 VLAN),它根本不想从调制解调器获取 IP 地址,当我设置 VLAN 标记时也是如此2 设置过程中:
但是,如果我在 Hyper-V 管理器中设置直接连接到 LAN,则获取 IP 地址没有问题:
nick@ubuntu-1:~$ ip addr
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
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:00:04:0a brd ff:ff:ff:ff:ff:ff
inet 192.168.0.171/24 brd 192.168.0.255 scope global dynamic eth0
valid_lft 43149sec preferred_lft 43149sec
inet6 2a02:1811:2501:9c10::669/128 scope global dynamic noprefixroute
valid_lft 83890sec preferred_lft 11890sec
inet6 fdd9:90ff:c1b6:10::669/128 scope global noprefixroute
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fe00:40a/64 scope link
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:74:f6:b4:25 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
4: flannel.1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN group default
link/ether be:57:d4:f0:61:f5 brd ff:ff:ff:ff:ff:ff
inet 10.1.86.0/32 scope global flannel.1
valid_lft forever preferred_lft forever
inet6 fe80::bc57:d4ff:fef0:61f5/64 scope link
valid_lft forever preferred_lft forever
我也用 Debian 9 & 10 对其进行了测试,它们似乎没有这些问题:
nick@Debian-1:~$ ip addr
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
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:00:04:02 brd ff:ff:ff:ff:ff:ff
inet 94.224.239.246/20 brd 94.224.239.255 scope global dynamic eth0
valid_lft 5459sec preferred_lft 5459sec
inet6 fe80::215:5dff:fe00:402/64 scope link
valid_lft forever preferred_lft forever
原来是我的路由器/调制解调器有问题,我对它们都进行了完全重置,这似乎解决了这个问题。很奇怪,我所有的其他虚拟机仍然没有任何问题得到他们的外部 IP。