内核路由表怎么会有IP地址全0的缺省网关,删都删不掉,没法通信
本帖最后由 mordorwww 于 2016-08-22 17:41 编辑删都删不掉,没法通信
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
0.0.0.0 1.1.1.50 0.0.0.0 UG 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~#
root@imx6solosabresd:~#
root@imx6solosabresd:~# root@imx6solosabresd:~# ifconfig
data Link encap:EthernetHWaddr 3A:F7:79:3A:05:3A
inet6 addr: fe80::38f7:79ff:fe3a:53a/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B)TX bytes:0 (0.0 B)
eth0 Link encap:EthernetHWaddr 7A:23:29:F8:7A:FE
UP BROADCAST MULTICASTMTU:1500Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNINGMTU:65536Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:700 (700.0 B)TX bytes:700 (700.0 B)
root@imx6solosabresd:~# ifconfig data 1.1.1.3
root@imx6solosabresd:~# ping 1.1.1.5^C
root@imx6solosabresd:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
1.0.0.0 * 255.0.0.0 U 0 0 0 data
root@imx6solosabresd:~# ping 1.1.1.50
PING 1.1.1.50 (1.1.1.50): 56 data bytes
64 bytes from 1.1.1.50: seq=0 ttl=64 time=3.502 ms
^C
--- 1.1.1.50 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 3.502/3.502/3.502 ms
root@imx6solosabresd:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
1.0.0.0 * 255.0.0.0 U 0 0 0 data
root@imx6solosabresd:~#
root@imx6solosabresd:~#
root@imx6solosabresd:~# route add -net 0.0.0.0 netmask 0.0.0.0 gw 1.1.1.5
root@imx6solosabresd:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 1.1.1.5 0.0.0.0 UG 0 0 0 data
default * 0.0.0.0 U 0 0 0 data
1.0.0.0 * 255.0.0.0 U 0 0 0 data
169.254.0.0 * 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~#
root@imx6solosabresd:~# ping 172.16.20.207
PING 172.16.20.207 (172.16.20.207): 56 data bytes
^C
--- 172.16.20.207 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss
root@imx6solosabresd:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 1.1.1.5 0.0.0.0 UG 0 0 0 data
default * 0.0.0.0 U 0 0 0 data
1.0.0.0 * 255.0.0.0 U 0 0 0 data
169.254.0.0 * 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~#
root@imx6solosabresd:~# ifconfig
data Link encap:EthernetHWaddr 3A:F7:79:3A:05:3A
inet addr:1.1.1.3Bcast:1.255.255.255Mask:255.0.0.0
inet6 addr: fe80::38f7:79ff:fe3a:53a/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:25 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B)TX bytes:0 (0.0 B)
eth0 Link encap:EthernetHWaddr 7A:23:29:F8:7A:FE
UP BROADCAST MULTICASTMTU:1500Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNINGMTU:65536Metric:1
RX packets:21 errors:0 dropped:0 overruns:0 frame:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1644 (1.6 KiB)TX bytes:1644 (1.6 KiB)
root@imx6solosabresd:~#
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
0.0.0.0 1.1.1.50 0.0.0.0 UG 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~#
root@imx6solosabresd:~# ifconfig
data Link encap:EthernetHWaddr 62:92:A6:FF:35:D4
inet addr:1.1.1.3Bcast:1.255.255.255Mask:255.0.0.0
inet6 addr: fe80::6092:a6ff:feff:35d4/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:224 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B)TX bytes:0 (0.0 B)
eth0 Link encap:EthernetHWaddr 3A:AA:00:99:4F:18
UP BROADCAST MULTICASTMTU:1500Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNINGMTU:65536Metric:1
RX packets:75 errors:0 dropped:0 overruns:0 frame:0
TX packets:75 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6160 (6.0 KiB)TX bytes:6160 (6.0 KiB)
跟网卡IP一个网段的路由,不需要nexthop 本帖最后由 mordorwww 于 2016-08-22 17:51 编辑
nswcfd 发表于 2016-08-22 17:37
跟网卡IP一个网段的路由,不需要nexthop
缺省路由啊,缺省路由没有网关,缺省路由是直连的!
root@imx6solosabresd:~# ifconfig data 1.1.1.3
root@imx6solosabresd:~#
root@imx6solosabresd:~# ifconfig
data Link encap:EthernetHWaddr 92:DA:27:BC:04:45
inet addr:1.1.1.3Bcast:1.255.255.255Mask:255.0.0.0
inet6 addr: fe80::90da:27ff:febc:445/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B)TX bytes:0 (0.0 B)
eth0 Link encap:EthernetHWaddr A6:34:70:AB:51:4F
UP BROADCAST MULTICASTMTU:1500Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNINGMTU:65536Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:700 (700.0 B)TX bytes:700 (700.0 B)
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
root@imx6solosabresd:~# route add default gw 1.1.1.50
root@imx6solosabresd:~#
root@imx6solosabresd:~# ping 1.1.1.50
PING 1.1.1.50 (1.1.1.50): 56 data bytes
64 bytes from 1.1.1.50: seq=0 ttl=64 time=3.516 ms
64 bytes from 1.1.1.50: seq=1 ttl=64 time=1.959 ms
^C
--- 1.1.1.50 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 1.959/2.737/3.516 ms
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 1.1.1.50 0.0.0.0 UG 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
root@imx6solosabresd:~#
root@imx6solosabresd:~#
root@imx6solosabresd:~# ping 172.16.20.207
PING 172.16.20.207 (172.16.20.207): 56 data bytes
^C
--- 172.16.20.207 ping statistics ---
3 packets transmitted, 0 packets received, 100% packet loss
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
0.0.0.0 1.1.1.50 0.0.0.0 UG 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~# route del default gw 1.1.1.50
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~# route del default gw 0.0.0.0
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~# ifconfig
data Link encap:EthernetHWaddr 92:DA:27:BC:04:45
inet addr:1.1.1.3Bcast:1.255.255.255Mask:255.0.0.0
inet6 addr: fe80::90da:27ff:febc:445/64 Scope:Link
UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
RX packets:26 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B)TX bytes:0 (0.0 B)
eth0 Link encap:EthernetHWaddr A6:34:70:AB:51:4F
UP BROADCAST MULTICASTMTU:1500Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNINGMTU:65536Metric:1
RX packets:13 errors:0 dropped:0 overruns:0 frame:0
TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1036 (1.0 KiB)TX bytes:1036 (1.0 KiB)
root@imx6solosabresd:~#
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~# route del default gw 0.0.0.0
root@imx6solosabresd:~# route del default
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 data
1.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 data
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 data
root@imx6solosabresd:~# 不好意思,看错了。
它是怎么生成的?
看起来是在 ping 172.16.20.207 的过程中后台产生的? 本帖最后由 nswcfd 于 2016-08-27 21:07 编辑
应该可以删除吧,估计是有后台运行的其它程序在不断尝试添加默认路由?
(以类似route add default dev data的形式)
而且从楼主的命令行里看,执行的route del default都成功了,否则会报SIOCDELRT:no such process的错误。 nswcfd 发表于 2016-08-27 21:11
而且从楼主的命令行里看,执行的route del default都成功了,否则会报SIOCDELRT:no such process的错误。
偶尔能删成功,一般是删不掉的
页:
[1]