更新:
操作系统没有问题。静态路由的网关有一些双重 NAT 规则,导致流量被丢弃。
我在 CentOS 服务器上进行了简单的网络设置。该服务器只有一个接口:
ifcfg-eth0:
IPADDR=85.15.17.156
PREFIX=23
GATEWAY=85.15.16.1
DNS1=85.15.16.20
DNS2=85.15.16.21
以下是它所显示的内容是否配置:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 85.15.17.156 netmask 255.255.254.0 broadcast 85.15.17.255
inet6 fe80::215:5dff:fe10:1c67 prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:10:1c:67 txqueuelen 1000 (Ethernet)
RX packets 2374071 bytes 726672271 (693.0 MiB)
RX errors 0 dropped 339562 overruns 0 frame 0
TX packets 84906 bytes 19020154 (18.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 74123 bytes 9265792 (8.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 74123 bytes 9265792 (8.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
我已经设置了两个静态路由,如下所示:
IP路由:
default via 85.15.16.1 dev eth0 proto static metric 100
85.15.16.0/23 dev eth0 proto kernel scope link src 85.15.17.156 metric 100
94.182.76.0/22 via 85.15.17.254 dev eth0 proto static metric 100
94.183.76.0/22 via 85.15.17.254 dev eth0 proto static metric 100
但是当我尝试 ping 其中一个子网中的 IP 时,似乎无法到达网关 (85.15.17.254):
[admin.local@server ~]$ tracepath 94.182.76.2
1?: [LOCALHOST] pmtu 1500
1: no reply
2: no reply
3: no reply
我可以 ping 和 ssh 网关(它是一个防火墙):
[admin.local@server ~]$ ping 85.15.17.254
PING 85.15.17.254 (85.15.17.254) 56(84) bytes of data.
64 bytes from 85.15.17.254: icmp_seq=1 ttl=255 time=0.681 ms
64 bytes from 85.15.17.254: icmp_seq=2 ttl=255 time=0.707 ms
编辑1:
有从网关到终端主机的路由:
ASA# sh run int
!
interface Port-channel1.299
nameif Outside
security-level 0
ip address 172.31.74.3 255.255.255.0 standby 172.31.74.4
!
interface Port-channel2.62
nameif Inside
security-level 100
ip address 85.15.17.254 255.255.254.0 standby 85.15.17.253
ASA# traceroute 94.182.76.2
Type escape sequence to abort.
Tracing the route to 94.182.76.2
1 172.31.74.1 1 msec 1 msec 1 msec
2 10.163.19.11 1 msec 1 msec 1 msec
3 * * *
4 94.182.19.252 210 msec 209 msec 214 msec
5 94.182.76.2 209 msec 209 msec 289 msec
服务器上的防火墙已禁用。知道我做错了什么吗?