網路設定問題,嘗試回應外部 ping 時出現“無法存取”

網路設定問題,嘗試回應外部 ping 時出現“無法存取”

我正在靜態 IP 上設置第二個網路接口,但它無法正常工作。

我能夠毫無問題地建立出站連接,例如

ping -i 66.249.80.104

但是當外部 ip ping 我的伺服器時,我收到資料包,但回覆說無法訪問

tcpdump -i eth1        
08:23:50.427576 IP external.com > 44c3e65d.static: ICMP echo request, id 65388, seq 0, length 64
08:53:55.084512 arp who-has 44c3e65d.static tell 44c3e65a.static
08:53:55.084518 arp reply 44c3e65d.static is-at 00:15:17:27:80:e1 (oui Unknown)
08:23:50.428775 44c3e65a.static > 44c3e65d.static: ICMP external.com protocol 1 port 63628 unreachable, length 92

我在 tcpdump 中也看到了很多這樣的內容

08:54:47.404489 802.1d config 8000.00:1c:57:f1:10:8a.8002 root 8000.00:1c:57:f1:10:8a pathcost 0 age 0 max 20 hello 2 fdelay 15 

我沒有打開 iptables,如果我從內部網路上的另一台電腦 ping 該靜態 IP,它工作得很好。

我不是系統管理員,所以我不太確定如何解決這個問題。我將不勝感激任何幫助 :)

答案1

這是網關的問題

使用“路線”給了我

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 eth0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1
68.0.0.0        *               255.0.0.0       U     0      0        0 eth1
default         192.168.2.1     0.0.0.0         UG    0      0        0 eth0

所以沒有為 eth1 配置網關,所以我這樣做了

route add -net default gw 68.195.x.x dev eth1

然後得到

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 eth0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1
68.0.0.0        *               255.0.0.0       U     0      0        0 eth1
default         44c3e659.st     0.0.0.0         UG    0      0        0 eth1
default         192.168.2.1     0.0.0.0         UG    0      0        0 eth0

我明白為什麼它無法回應外部 ping,但我對如何能夠在外部伺服器上成功執行 ping 感到有點困惑?我的猜測是它使用了 eth0,儘管我明確告訴它使用 eth1

答案2

第二個介面是否配置了預設網關?如果不是,那可能就是問題所在。

相關內容