DHCP 在 22.04 上不起作用,未获取网关 IP

DHCP 在 22.04 上不起作用,未获取网关 IP

我以前使用固定 IP 地址,但现在必须使用 DHCP,现在出现的问题是,如果我选择USE DHCP网络选项,我就无法获得网关 IP 地址。

以 // 开头的行是注释 - 只是为了澄清。

//  With DHCP active.

me@me-desktop:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 eno1
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 eno1

//  Note here 4 lines given back.  (above)

me@me-desktop:~$ ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.146  netmask 255.255.255.0  broadcast 192.168.0.255
        ether 94:c6:91:11:55:10  txqueuelen 1000  (Ethernet)
        RX packets 78160  bytes 32127382 (32.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 61451  bytes 9398783 (9.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xdc200000-dc220000  

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 17637  bytes 1350767 (1.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17637  bytes 1350767 (1.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

me@me-desktop:~$ ping 8.8.8.8
ping: connect: Network is unreachable
me@me-desktop:~$

//  With Static IP set.

me@me-desktop:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gateway         0.0.0.0         UG    100    0        0 eno1
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 eno1
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 eno1

//  Note here 5 lines given and there is a DEFAULT GATEWAY line.

me@me-desktop:~$ ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.6  netmask 255.255.255.0  broadcast 192.168.0.255
        ether 94:c6:91:11:55:10  txqueuelen 1000  (Ethernet)
        RX packets 87697  bytes 33731832 (33.7 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 64112  bytes 9669285 (9.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xdc200000-dc220000  

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 17998  bytes 1376581 (1.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17998  bytes 1376581 (1.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

me@me-desktop:~$ ping 8.8.8.8
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=116 time=11.5 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=10.9 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 10.866/11.175/11.485/0.309 ms

这使得使用 DHCP 变得非常困难。

如何让 DHCP 正常工作?提前致谢。

相关内容