내 라우터의 IP 주소는 192.168.4.1이지만 0.0.0.0 대상에 대한 Ubuntu의 게이트웨이(192.168.1.1)가 잘못되었습니다.
$ sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 202 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 204 0 0 docker0
169.254.0.0 0.0.0.0 255.255.0.0 U 207 0 0 veth25c3672
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-b0d0fb5e0e31
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
192.168.4.0 0.0.0.0 255.255.252.0 U 100 0 0 eth0
저는 Raspberry Pi에서 Ubuntu 20.10을 실행하고 있습니다.
편집하다:
이것은 다음의 출력입니다 ip addr
.
$ 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 dc:a6:32:94:9c:f9 brd ff:ff:ff:ff:ff:ff
inet 192.168.4.111/22 brd 192.168.7.255 scope global dynamic noprefixroute eth0
valid_lft 13792sec preferred_lft 13792sec
inet 192.168.1.111/24 brd 192.168.1.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fda1:a63d:515d:3:406:1189:9d9a:cb0a/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 1763sec preferred_lft 1763sec
inet6 fe80::dea6:32ff:fe94:9cf9/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether dc:a6:32:94:9c:fa brd ff:ff:ff:ff:ff:ff
4: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:84:54:17 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
inet 169.254.144.13/16 brd 169.254.255.255 scope global noprefixroute docker0
valid_lft forever preferred_lft forever
inet6 fe80::1aae:616e:f298:1a57/64 scope link
valid_lft forever preferred_lft forever
5: br-b0d0fb5e0e31: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:c2:38:d1:89 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 brd 172.18.255.255 scope global br-b0d0fb5e0e31
valid_lft forever preferred_lft forever
7: veth25c3672@if6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default
link/ether 5e:70:b9:32:6d:76 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 169.254.131.198/16 brd 169.254.255.255 scope global noprefixroute veth25c3672
valid_lft forever preferred_lft forever
inet6 fe80::2171:b3e8:2409:538a/64 scope link
valid_lft forever preferred_lft forever
inet6 fe80::5c70:b9ff:fe32:6d76/64 scope link
valid_lft forever preferred_lft forever
나는 또한 다음 명령을 실행했습니다.
systemctl stop dhcpcd ; rm /var/lib/dhcpcd*/*lease* ; systemctl start dhcpcd
하지만 나쁜 게이트웨이가 191.168.1.1
계속 나타납니다.eth0
$ sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 202 0 0 eth0
0.0.0.0 192.168.4.1 0.0.0.0 UG 20100 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 204 0 0 docker0
169.254.0.0 0.0.0.0 255.255.0.0 U 207 0 0 veth25c3672
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-b0d0fb5e0e31
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
192.168.4.0 0.0.0.0 255.255.252.0 U 100 0 0 eth0
답변1
inet 192.168.4.111/22 brd 192.168.7.255 scope global dynamic noprefixroute eth0
valid_lft 13792sec preferred_lft 13792sec
위의 내용은 DHCP에서 오는 것임을 보여줍니다.
그리고 아래 내용은 그것이 정적이라는 것을 보여줍니다. NetworkManager를 통해 발생하는 경우가 많습니다. 거기에서 삭제하세요.
inet 192.168.1.111/24 brd 192.168.1.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever