Networking

簡單拓撲中的路由/網關問題

  • September 30, 2015

為了為我的公司網路提供第二個“備份”網關,我嘗試實現此拓撲:在此處輸入圖像描述

這很簡單,調製解調器和路由器之間的網路是 192.168.1.0/24,路由器和工作站之間的網路是 192.168.10.0/24。實際的 IP 地址是草圖上的那些。

路由器介面狀態如下:

cisco1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.69    YES NVRAM  up                    up
FastEthernet0/1            192.168.10.69   YES NVRAM  up                    up
Serial0/0/0 

路由表是這樣的:

cisco1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
      D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
      N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
      E1 - OSPF external type 1, E2 - OSPF external type 2
      i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
      ia - IS-IS inter area, * - candidate default, U - per-user static route
      o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
      + - replicated route, % - next hop override

Gateway of last resort is 192.168.1.1 to network 0.0.0.0

S*    0.0.0.0/0 [1/0] via 192.168.1.1
     192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, FastEthernet0/0
L        192.168.1.69/32 is directly connected, FastEthernet0/0
     192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.10.0/24 is directly connected, FastEthernet0/1
L        192.168.10.69/32 is directly connected, FastEthernet0/1

如您所見,我已將調製解調器的 IP 地址配置為最後的網關,以便數據包以這種方式到達 Internet。

我還為我的測試 PC 配置了 IP 192.168.10.13、遮罩 255.255.255.0 和預設網關 192.168.10.69。

現在這很奇怪:從路由器的 CLI 中,我可以成功 ping 192.168.1.1、192.168.1.69、192.168.10.69 和 192.168.10.13。從測試 PC 我只能成功 ping 192.168.1.69 和 192.168.10.69。嘗試從測試 PC ping 192.168.1.1 時失敗。

當然,我沒有來自測試 PC 的 Internet 連接。

現在,有什麼我忽略的嗎?為什麼我無法連接到網際網路?

更新:

經過更多檢查,我的路由表看起來很可疑。為什麼直連的網路會被這樣打斷?我以前從未見過路由表中提到的介面 IP 地址作為單獨的“/32”直接連接的子網。

有誰知道為什麼會這樣?我有一種強烈的感覺,這可能與我的連接問題有關。

正如@cpt_fink 已經說過的那樣,問題是反向路線: 在此處輸入圖像描述

在路由器上配置 NAT。我發現了一篇關於該主題的精彩文章: http ://www.firewall.cx/cisco-technical-knowledgebase/cisco-routers/260-cisco-router-nat-overload.html

以相反的順序…

您的路由表實際上是正確的。該L標誌表示該鏈路上路由器的本地 IP 地址,而該C標誌表示該網路連接到該鏈路上的路由器。

問題是您的調製解調器不知道 192.168.10.0 /24 網路可以通過 192.16.1.69 訪問,或者沒有 .10.x 子網的 NAT 策略。

引用自:https://serverfault.com/questions/725492