我几天来一直在墙上砸头,试图弄清楚这一点:我的ifconfig是:
eth0 Link encap:Ethernet HWaddr 00:50:56:BB:XX:XX
inet addr:192.168.36.132 Bcast:192.168.37.255 Mask:255.255.254.0
eth1 Link encap:Ethernet HWaddr 00:50:56:BB:XX:XX
inet addr:116.xx.xx.xx Bcast:116.xx.xx.xx Mask:255.255.255.192
当我尝试添加一条静态路由以退出eth0时,出现以下错误:
servername-test:/ # route add -net 10.248.12.0 netmask 255.255.255.240 gw 192.168.36.254 dev eth0
SIOCADDRT: Network is unreachable
我的默认网关是:
servername-test:~ # netstat -anr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
116.xx.xx.xx 0.0.0.0 255.255.255.192 U 0 0 0 eth1
192.168.238.0 192.168.36.254 255.255.255.0 UG 0 0 0 eth0
192.168.239.0 192.168.36.254 255.255.255.0 UG 0 0 0 eth0
192.168.36.0 192.168.36.254 255.255.254.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 116.xx.xx.xx 0.0.0.0 UG 0 0 0 eth1
ip route list
输出
116.66.240.64/26 dev eth1 proto kernel scope link src 116.xx.xx.xx
192.168.238.0/24 via 192.168.36.254 dev eth0
192.168.239.0/24 via 192.168.36.254 dev eth0
192.168.36.0/23 via 192.168.36.254 dev eth0
169.254.0.0/16 dev eth0 scope link
127.0.0.0/8 dev lo scope link
default via 116.xx.xx.xx dev eth1
ip路由:
—
AnonPoster 2014年
116.66.240.64/26 dev eth1 proto kernel scope link src 116.xx.xx.xx 192.168.238.0/24 via 192.168.36.254 dev eth0 192.168.239.0/24 via 192.168.36.254 dev eth0 192.168.36.0/23 via 192.168.36.254 dev eth0 169.254.0.0/16 dev eth0 scope link 127.0.0.0/8 dev lo scope link default via 116.xx.xx.xx dev eth1
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:50:56:xx:xx:xx brd ff:ff:ff:ff:ff:ff inet 192.168.36.132/23 brd 192.168.37.255 scope global eth0 inet6 fe80::xxx:xxx:xxx:xxx/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:50:56:xx:xx:xx brd ff:ff:ff:ff:ff:ff inet 116.xx.xx.xx/26 brd 116.xx.xx.xx scope global eth1 inet6 fe80::xxx:xxx:xxx:xxx/64 scope link valid_lft forever preferred_lft forever
我的意思是请编辑您的原始帖子,并包含我要求的信息。将输出粘贴到注释中会使它完全不可读。
—
daff 2014年
添加默认路由时,我也遇到了与HPUX服务器相同的问题,因为我无法访问网络外部可用的服务器。所以我得到了正确的命令来添加默认值并在hpux中检查路由表,在这里您也可以尝试,我希望这也可以帮助您解决问题:)
/sbin/ip addr
和/sbin/ip route
?这些对于调试比ifconfig和netstat更有用。