ISP(config)# interface serial 3/0
ISP(config-if)# ip address 10.10.1.2 255.255.255.0
ISP(config-if)# no shutdown
ISP(config-if)# exit
ISP(config)# ip route 172.16.0.0 255.255.0.0 serial 3/0
ISP(config)# ip route 192.168.1.0 255.255.255.0 serial 3/0
ISP(config)# ip route 192.168.2.0 255.255.255.0 serial 3/0
其實這三行可以用 ip route 0.0.0.0 0.0.0.0 serial 3/0 取代
因為採用這行代表的意思是告訴路由器 "只要東西(封包)不是我的就往外丟"
指令做到這,沒意外的話各主機都可以互相PING的通
接著我們來查看一下各路由器的路由表
回到底層輸入 show ip route
R1的路由表:
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, FastEthernet0/0
C 172.16.2.0 is directly connected, FastEthernet1/0
R 192.168.1.0/24 [120/1] via 192.168.2.2, 00:00:00, Serial2/0
C 192.168.2.0/24 is directly connected, Serial2/0
R* 0.0.0.0/0 [120/1] via 192.168.2.2, 00:00:00, Serial2/0
R* 代表的是預設繞送那顆路由器(R2)傳來的資訊
R 就是從R2的Serial 2/0傳來的資訊
C 是直接連接的介面
R2的路由表:
C 10.10.1.0 is directly connected, Serial3/0
R 172.16.0.0/16 [120/1] via 192.168.2.1, 00:00:19, Serial2/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial2/0
S* 0.0.0.0/0 is directly connected, Serial3/0
C 10.10.1.0 is directly connected, Serial3/0
S 172.16.0.0/16 is directly connected, Serial3/0
S 192.168.1.0/24 is directly connected, Serial3/0
S 192.168.2.0/24 is directly connected, Serial3/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
三條都是靜態路由
但是如果我設定的是 ip route 0.0.0.0 0.0.0.0 serial 3/0 這樣的預設繞送
路由表又會有什麼樣的差異呢?
10.0.0.0/24 is subnetted, 1 subnets
C 10.10.1.0 is directly connected, Serial3/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
S* 0.0.0.0/0 is directly connected, Serial3/0