在运行了一个(可能已损坏) openvpn脚本之后,我有一个IP路由表,其中一个条目是URL:
# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default 10.0.0.1 0.0.0.0 UG 0 0 0 wlp58s0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp58s0
google.com 10.0.0.1 255.255.255.255 UGH 0 0 0 wlp58s0如何删除最后一行?常规方式会引发错误:
# ip route del google.com
Error: any valid prefix is expected rather than "google.com".如果这重要的话,我现在使用的是gentoo linux。
发布于 2018-07-28 17:19:00
条目google.com不是一个URL;它是一个域名,或者可能是一个主机名。(不过,它可能是URL的一部分。)
如果您使用netstat -rn,您将在第一列中获得IP地址而不是名称。从那里,您可以删除路由-再次引用其网络和子网寻址。
netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default server.roaima 0.0.0.0 UG 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
google.com 0.0.0.0 255.255.255.255 UH 0 0 0 eth1
netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.2.2 0.0.0.0 UG 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
216.58.198.174 0.0.0.0 255.255.255.255 UH 0 0 0 eth1
route delete -host 216.58.198.174您也可以使用更新的ip route进行此操作,后者只列出具有IP地址的路由。使用ip route del删除不需要的条目。
https://unix.stackexchange.com/questions/459064
复制相似问题