Ubuntu Server 20.04 网络配置

Ubuntu Server 20.04 网络配置

我在 Windows Hyper-V 主机上的虚拟机中安装了 Ubuntu Server 20.04。
我希望它从本地网络中的 Windows DHCP 服务器获取 IP 地址,但它不起作用,我不知道为什么。具有相同配置的 Windows 虚拟机运行正常。

ip a输出:

1: lo: <L00PBACK,UP,L0WER_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:28:18 brd ff:ff:ff:ff:ff:ff
 inet6 fe80::215:5dff:fe00:2818/64 scope link
    valid.lft forever preferred.lft forever

内容/etc/netplan/00-installer-config.yaml

network:
  ethernets:
    eth0:
      dhcp4: true
  version: 2

输出sudo netplan --debug generate

DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:1818): DEBUG: 12:50:00.358: Processing input file /etc/netplan/00-installer-config.yaml..
** (generate:1818): DEBUG: 12:50:00.359: starting new processing pass
** (generate:1818): DEBUG: 12:50:00.360: We have some netdefs, pass them through a final round of validation
** (generate:1818): DEBUG: 12:50:00.360: eth0: setting default backend to 1
** (generate:1818): DEBUG: 12:50:00.361: Configuration is valid
** (generate:1818): DEBUG: 12:50:00.361: Generating output files..
** (generate:1818): DEBUG: 12:50:00.362: openvswitch: definition eth0 is not for us (backend 1)
** (generate:1818): DEBUG: 12:50:00.363: NetworkManager: definition eth0 is not for us (backend 1)
(generate:1818): GLib-DEBUG: 12:50:00.363: posix_spawn avoided (fd close requested)
(generate:1818): GLib-DEBUG: 12:50:00.365: posix_spawn avoided (fd close requested)

输出sudo netplan --debug apply

** (generate:1826): DEBUG: 12:53:09.513: Processing input file /etc/netplan/00-installer-config.yaml..
** (generate:1826): DEBUG: 12:53:09.514: starting new processing pass
** (generate:1826): DEBUG: 12:53:09.515: He have some netdefs, pass them through a final round of validation
** (generate:1826): DEBUG: 12:53:09.516: eth0: setting default backend to 1
** (generate:1826): DEBUG: 12:53:09.517: Configuration is valid
** (generate:1826): DEBUG: 12:53:09.518: Generating output files..
** (generate:1826): DEBUG: 12:53:09.519: openvswitch: definition eth0 is not for us (backend 1)
** (generate:1826): DEBUG: 12:53:09.520: NetworkManager: definition eth0 is not for us (backend 1)
(generate:1826): GLib-DEBUG: 12:53:09.521: posix_spawn avoided (fd close requested)
(generate:1826): GLib-DEBUG: 12:53:09.523: posix_spawn avoided (fd close requested)
DEBUG:netplan generated networkd configuration changed, restarting networkd
DEBUG:eth0 not found in {}
DEBUG:Merged config:
network:
  ethernets:
    eth0:
      dhcp4: true
  version: 2
  
DEBUG:no netplan generated NM configuration exists
DEBUG:eth0 not found in {}
DEBUG:Merged config:
network:
  ethernets:
    eth0:
      dhcp4: true
  version: 2
  
DEBUG:Link changes: {}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for eth0
DEBUG:eth0 not found in {}
DEBUG:Merged config:
network:
  ethernets:
    eth0:
      dhcp4: true
  version: 2

cat /etc/network/interfaces输出

cat: /etc/network/interfaces/: No such file or directory

ls -al /etc/netplan 输出

total 12
drwxr-xr-x 2    root    root    4096    Nov 26  14:01
drwxr-xr-x 106  root    root    4096    Nov 25  16:45
-rw-r--r-— 1    root    root    115     Nov 26  14:01   00-installer-config.yaml

cat /etc/netplan/*.yaml输出

# This is the network config written by 'subiquity'
network:
  ethernets:
    eth0:
      dhcp4: true
  version: 2

sudo lshw -C network输出

[77792.441265] blk_update_request: I/O error, dev sr0, sector 0 op 0x0: (READ) flags 0x80700 phys_seg 4 prio class 0     
[77792.442325] blk_update_request: I/O error, dev sr0, sector 0 op 0x0: (READ) flags 0x0 phys_seg 1 prio class 0
[77792.443250] Buffer I/O error on dev sr0, logical block 0, async page read       
[77792.444154] blk_update_request: I/O error, dev sr0, sector 1 op 0x0: (READ) flags 0x0 phys_seg 1 prio class 0
[77792.445145] Buffer I/O error on dev sr0, logical block 1, async page read       
[77792.446145] blk_update_request: I/O error, dev sr0, sector 2 op 0x0: (READ) flags 0x0 phys_seg 1 prio class 0
[77792.447102] Buffer I/O error on dev sr0, logical block 2, async page read       
[77792.448088] blk_update_request: I/O error, dev sr0, sector 3 op 0x0: (READ) flags 0x0 phys_seg 1 prio class 0
[77792.449085] Buffer I/O error on dev sr0, logical block 3, async page read       
[77792.450098] blk_update_request: I/O error, dev sr0, sector 4 op 0x0: (READ) flags 0x0 phys_seg 1 prio class 0
[77792.451058] Buffer I/O error on dev sr0, logical block 4, async page read       
[77792.452411] blk_update_request: I/O error, dev sr0, sector 5 op 0x0: (READ) flags 0x0 phys_seg 1 prio class 0
[77792.453448] Buffer I/O error on dev sr0, logical block 5, async page read       
[77792.454518] blk_update_request: I/O error, dev sr0, sector 6 op 0x0: (READ) flags 0x0 phys_seg 1 prio class 0
[77792.455569] Buffer I/O error on dev sr0, logical block 6, async page read       
[77792.456646] blk_update_request: I/O error, dev sr0, sector 7 op 0x0: (READ) flags 0x0 phys_seg 1 prio class 0
[77792.457762] Buffer I/O error on dev sr0, logical block 7, async page read       
[77792.458901] blk_update_request: I/O error, dev sr0, sector 0 op 0x0: (READ) flags 0x0 phys_seg 1 prio class 0
[77792.460028] Buffer I/O error on dev sr0, logical block 0, async page read       
[77792.461166] Buffer I/O error on dev sr0, logical block 1, async page read       
    *-network
        description: Ethernet interface
        physical id: 1
        logical name: eth0
        serial: 00:15:5d:00:28:18
        size: 1Gbit/s
        capabilities: ethernet physical
        configuration: autonegotiation=off broadcast=yes driver=hv_netvsc duplex=full firmware=N/A link=yes multicast=yes speed=lGbit/s

相关内容