【solved】route命令显示default gateway是localhost
发表于 : 2013-05-07 20:08
route命令显示default gateway是localhost
route -n显示gateway ip 是 192.168.1.1
我查了一下man route, -n选项表示不解析ip地址到hostname
我查看了/etc/hosts文件,localhost对应的ip是127.0.0.1
我的问题是:route命令显示的localhost到192.168.1.1的对应关系是怎么回事?
下面是命令的执行情况:
dylan@ubuntu:/home/dylan# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default localhost 0.0.0.0 UG 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
dylan@ubuntu:/home/dylan# 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 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
dylan@ubuntu:/home/dylan# cat /etc/hosts
127.0.0.1 localhost
route -n显示gateway ip 是 192.168.1.1
我查了一下man route, -n选项表示不解析ip地址到hostname
我查看了/etc/hosts文件,localhost对应的ip是127.0.0.1
我的问题是:route命令显示的localhost到192.168.1.1的对应关系是怎么回事?
下面是命令的执行情况:
dylan@ubuntu:/home/dylan# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default localhost 0.0.0.0 UG 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
dylan@ubuntu:/home/dylan# 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 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
dylan@ubuntu:/home/dylan# cat /etc/hosts
127.0.0.1 localhost