我在将 Ubuntu 服务器连接到网络时遇到了最大的困难,我感觉这是因为我的路由不正确。有人能帮我吗?
网络管理员提供的网络配置:IPv4:xxx.xxx.xxx.150 子网:xxx.xxx.xxx.128/25 网关:xxx.xxx.xxx.129 子网掩码:255.255.255.128 完全限定域名:aaa.bbb.ccc.com DNS 名称服务器 1:X DNS 名称服务器 2:Y DNS 名称服务器 3:Z
$ cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto p5p2
iface p5p2 inet static
address xxx.xxx.xxx.150
gateway xxx.xxx.xxx.129
netmask 255.255.255.128
network xxx.xxx.xxx.128/25
broadcast xxx.xxx.xxx.255
dns-domain ccc.com
dns-search ccc.com bbb.ccc.com
dns-nameservers X Y Z
$ ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:12493 errors:0 dropped:0 overruns:0 frame:0
TX packets:12493 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:685849 (685.8 KB) TX bytes:685849 (685.8 KB)
p5p2 Link encap:Ethernet HWaddr 00:25:90:c0:bf:f3
inet addr:xxx.xxx.xxx.150 Bcast:xxx.xxx.xxx.255 Mask:255.255.255.128
inet6 addr: xxxx::xxx:xxxx:xxxx:bff3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:164475 errors:0 dropped:0 overruns:0 frame:0
TX packets:1827 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15147287 (15.1 MB) TX bytes:137569 (137.5 KB)
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 xxx.xxx.xxx.129 0.0.0.0 UG 0 0 0 p5p2
xxx.xxx.xxx.128 0.0.0.0 255.255.255.128 U 0 0 0 p5p2
$ ping -c 4 xxx.xxx.xxx.129
PING xxx.xxx.xxx.129 (xxx.xxx.xxx.129) 56(84) bytes of data.
From xxx.xxx.xxx.150 icmp_seq=1 Destination Host Unreachable
From xxx.xxx.xxx.150 icmp_seq=2 Destination Host Unreachable
From xxx.xxx.xxx.150 icmp_seq=3 Destination Host Unreachable
From xxx.xxx.xxx.150 icmp_seq=4 Destination Host Unreachable
--- xxx.xxx.xxx.129 ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 2999ms
pipe 3
$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 localhost
xxx.xxx.xxx.150 aaa.bbb.ccc.com aaa
答案1
这不太可能是路由问题 - 更可能是电缆或驱动程序故障。
第一步是看看您是否可以 ping 通网关 (xxx.xxx.xxx.129)。如果可以,则可以查看路由,如果不行,则需要查看较低级别 - 我认为问题出在较低级别。