Router Table come from?
1.自己產生。
2.手動建立。
3.就由鄰近的Router相互自動交換學習。
Static Route(靜態路由)
Router(config)#ip route 192.168.1.0 255.255.255.0 10.1.1.2
(ip route Destination_prefix Destination _prefix_mask Forwarding_router's_address)
Router(config)#ip route 192.168.1.0 255.255.255.0 ?
A.B.C.D Forwarding router's address
Ethernet IEEE 802.3
FastEthernet FastEthernet IEEE 802.3
GigabitEthernet GigabitEthernet IEEE 802.3z
Loopback Loopback interface
Null Null interface
Serial Serial
Vlan Catalyst Vlans
Ping無回應的狀況
1.Destination host unreachable.
Router不知道封包該往哪送,所以Router就直接回應給封包發送端說[無法到達目的地]。
PC>ping 192.168.1.1
Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.2.254: Destination host unreachable.
Reply from 192.168.2.254: Destination host unreachable.
Reply from 192.168.2.254: Destination host unreachable.
Reply from 192.168.2.254: Destination host unreachable.
2.Request timed out.
封包沒有在規定的時間內回傳(預設1sec),逾時,原因不清楚,可能是封包回不來,也可能是目的地不存在(故障),但可以確定的是本地端的Router已經把封包送出去了。
PC>ping 192.168.2.1
Pinging 192.168.2.1 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
windows tracert
UNIX traceroute
CISCO traceroute
Dynamic Route(動態路由)
RIP(Routing Information Protoccol)
RIP2(Routing Information Protoccol V2)
IGRP(Interior Gateway Routing Protocol)
EIGRP(Enhance Interior Gateway Routing Protocol)
OSPF(Open Shortest Path First)
網路級別(Classful、Classless)
有級別路由(Classful Routing):網路上所有主機及路由器介面使用相同的Subnet Mask。
RIP、IGRP。
無級別路由(Classless Routing):每個網段可以使用不同Subnet Mask。
RIP2、EIGRP、OSPF。
RIP
Router-0(config)#router ?
bgp Border Gateway Protocol (BGP)
eigrp Enhanced Interior Gateway Routing Protocol (EIGRP)
ospf Open Shortest Path First (OSPF)
rip Routing Information Protocol (RIP)
Router-0(config)#router rip
Router-0(config-router)#?
auto-summary Enter Address Family command mode(路徑總結)
default-information Control distribution of default information
distance Define an administrative distance
exit Exit from routing protocol configuration mode
network Enable routing on an IP network
no Negate a command or set its defaults
passive-interface Suppress routing updates on an interface
(限制RIP宣傳,不希望透過WAN送到外部網路)
redistribute Redistribute information from another routing protocol
timers Adjust routing timers
version Set routing protocol version
Router-0(config-router)#network 192.168.0.0
Router-0(config-router)#network 10.0.0.0
Router-1(config-router)#do sh ip rou
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
Gateway of last resort is not set
10.0.0.0/29 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/1
R 192.168.0.0/24 [120/1] via 10.1.1.1, 00:00:19, FastEthernet0/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
R 192.168.2.0/24 [120/1] via 10.1.1.3, 00:00:24, FastEthernet0/1
Router-2(config)#router rip
Router-2(config-router)#passive-interface serial 0/1/0
Router-2(config-router)#do sh run
!
router rip
passive-interface Serial0/1/0
network 10.0.0.0
network 192.168.2.0
RIP與RIP2比較表
RIP RIP2
有級別 無級別
Broadcast Multicast
不支援VLSM(可變長度Subnet Mask) 支援VLSM
不支援非連續網路 支援非連續網路
沒有認證 可以使用MD5認證
不支援路徑總結 支援路徑總結
無級別網路(Classless)及路徑總結(Summary)
Summary,把原本分開的許多網段,合併成為一個大網段,減少Route Table資料量,及增加效率。
如:
192.168.0.0/24、192.168.1.0/24、192.168.2.0/24、192.168.2.0/24四個網段,原本Route Table要四筆,可合併為192.168.0.0/22,濃縮為一筆。
RIP2
Router-1(config)#router rip
Router-1(config-router)#version 2
Router-1(config-router)#no auto-summary(非連續網段,避免總結後造成Route錯誤)
Router-1(config-router)#network 192.168.1.0
Router-1(config-router)#network 10.0.0.0
Router-2#sh ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
Gateway of last resort is not set
10.0.0.0/29 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/1
C 192.168.0.0/24 is directly connected, FastEthernet0/0
192.168.1.0/25 is subnetted, 2 subnets
R 192.168.1.0 [120/1] via 10.1.1.1, 00:00:26, FastEthernet0/1
R 192.168.1.128 [120/1] via 10.1.1.2, 00:00:16, FastEthernet0/1
Router-2#show ip protocol
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 3 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 2, receive 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/1 2 2
FastEthernet0/0 2 2
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
10.0.0.0
192.168.0.0
Passive Interface(s):
Routing Information Sources:
Gateway Distance Last Update
10.1.1.1 120 00:00:01
10.1.1.2 120 00:00:19
Distance: (default is 120)
Router-2#debug ip rip(如果是使用Telnet,必須再使用terminal monitor,才能看到訊息)
Router-2#no debug ip rip(先輸入,利用上下鍵,適時將debug及時停止)
RIP protocol debugging is off
Router-2#debug ip rip
RIP protocol debugging is on
RIP: received v2 update from 10.1.1.1 on FastEthernet0/1
192.168.1.0/25 via 0.0.0.0 in 1 hops
RIP: received v2 update from 10.1.1.2 on FastEthernet0/1
192.168.1.128/25 via 0.0.0.0 in 1 hops
RIP: sending v2 update to 224.0.0.9 via FastEthernet0/1 (10.1.1.3) (Muticast)
RIP: build update entries
192.168.0.0/24 via 0.0.0.0, metric 1, tag 0
RIP: sending v2 update to 224.0.0.9 via FastEthernet0/0 (192.168.0.254)(Muticast)
RIP: build update entries
10.1.1.0/29 via 0.0.0.0, metric 1, tag 0
192.168.1.0/25 via 0.0.0.0, metric 2, tag 0
192.168.1.128/25 via 0.0.0.0, metric 2, tag 0
Router-2#no debug ip rip
IGRP
是CISCO專屬。
EIGRP
是IGRP的加強版,也是CISCO專屬。
EIGRP與RIP協定的差異
RIP
使用中繼站(Hop)的數量來衡量最佳路徑(最多支援的Hop數量為15,Hop超過15的路徑視為斷線)。
每隔固定時間傳送路徑更新資訊。
EIGRP
採用複合式衡量指標來挑選最佳路徑,預設會考慮線路的頻寬與延遲做為參考指標,還可以參考可靠性、負載、與最大傳輸單位等指標。
當網路拓樸有異動時才傳更新資訊。
支援的Hop最多到255點,支援Classless網路,支援VLSM與Auto-summary。
EIGRP更新Route Table的方式,須符合以下條件才分享路徑資料
1.收到Hello或ACK封包。
2.AS(Autonomous System自治系統)號碼相同。
3.距離計算係數-K值相同(通常不會刻意修改)。
K值有5個,K1=1,K2=0,K3=1,K4=0,K5=0,K值不一樣不會形成鄰居。
EIGRP資料更新方式
當發現新鄰居時,傳送完整Route Table,之後只傳異動部分,無異動就不再傳資料,適合大型網路。
EIGRP
Router-2(config)#router eigrp 10(啟用EIGRP,並宣告AS=10)
Router-2(config-router)#network 192.168.0.0 255.255.255.0(另有一種Wildcard宣告方式)
Router-2(config-router)#network 10.1.1.0 255.255.255.248(另有一種Wildcard宣告方式)
Router-2(config-router)#no auto-summary
Router-2#sh ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
Gateway of last resort is not set
10.0.0.0/29 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/1
C 192.168.0.0/24 is directly connected, FastEthernet0/0
192.168.1.0/25 is subnetted, 2 subnets
D 192.168.1.0 [90/30720] via 10.1.1.1, 00:11:24, FastEthernet0/1
D 192.168.1.128 [90/30720] via 10.1.1.2, 00:07:22, FastEthernet0/1
Router-2#sh ip route eigrp
192.168.1.0/25 is subnetted, 2 subnets
D 192.168.1.0 [90/30720] via 10.1.1.1, 00:11:34, FastEthernet0/1
D 192.168.1.128 [90/30720] via 10.1.1.2, 00:07:31, FastEthernet0/1
Router-2#sh ip eigrp neighbors
IP-EIGRP neighbors for process 10
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
0 10.1.1.1 Fa0/1 12 00:13:05 40 1000 0 13
1 10.1.1.2 Fa0/1 11 00:09:03 40 1000 0 13
Router-2#sh ip eigrp topology
IP-EIGRP Topology Table for AS 10
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - Reply status
P 192.168.0.0/24, 1 successors, FD is 28160
via Connected, FastEthernet0/0
P 10.1.1.0/29, 1 successors, FD is 28160
via Connected, FastEthernet0/1
P 192.168.1.0/25, 1 successors, FD is 30720
via 10.1.1.1 (30720/28160), FastEthernet0/1
P 192.168.1.128/25, 1 successors, FD is 30720
via 10.1.1.2 (30720/28160), FastEthernet0/1
Router-2#no debug eigrp packets
EIGRP Packets debugging is off
Router-2#debug eigrp packets
EIGRP Packets debugging is on
(UPDATE, REQUEST, QUERY, REPLY, HELLO, ACK )
Router-2#
EIGRP: Received HELLO on FastEthernet0/1 nbr 10.1.1.1
AS 10, Flags 0x0, Seq 14/0 idbQ 0/0
EIGRP: Received HELLO on FastEthernet0/1 nbr 10.1.1.2
AS 10, Flags 0x0, Seq 14/0 idbQ 0/0
EIGRP: Sending HELLO on FastEthernet0/1
AS 10, Flags 0x0, Seq 14/0 idbQ 0/0 iidbQ un/rely 0/0
EIGRP: Sending HELLO on FastEthernet0/0
AS 10, Flags 0x0, Seq 14/0 idbQ 0/0 iidbQ un/rely 0/0
debug ip eigrp notification
顯示網路上發生的EIGRP異動與更新。
OSPF(Open Shortest Path first)
最短路徑優先,一種開放式的路由協定。
OSPF與EIGRP的差別
1.Hop Count上限:OSPF沒有上限
2.設定難易:OSPF設定較為複雜。
OSPF設計,以階層式架構來設計,將大型網路分割成數個較小的區域(Area)相互連結。
Area 0 ,稱之為BackBone Area(骨幹區域),其餘Area必須要和Area 0相連,如只規畫一個Area也可以,就是只有Area。
OSPF的設定基本項目有
1.啟用OSPF協定,並給予Process ID(1~65535)。
一台Router允許執行多個OSPF程序,用不同ID以區別,這個值只對本機有效,與其他Router無任何關係。
2.宣告網段範圍,並宣告屬於哪一個Area。
OSPF運作方式
1.Router ID(RID):用來識別Router的IP Address,一般為了穩定性,會在Router上介面設定虛擬LookBack IP Address(繞回位址)供辨識,當線路故障時,這個LookBack IP Address仍然可以持續運作。
以最高LookBack IP Address為RID,沒有設定時,以實體介面中數值最高的IP Address作為RID。
2.Hello封包:發送Hello封包自動發現鄰居,維護鄰居關係。
3.Nerighbor(鄰居):只有介面在相同網段,即可成為鄰居。
4.Adjacency(緊鄰關係):OSPF只與有良好關係(Adjacency)交換路由資料,能否建立Adjacency取決於Router的設定與網路的類型。
5.Neighborship Database(鄰居關係資料庫):所有OSPF鄰居清單,內容包含RID、Router狀態與其他細節。
6.Topology Database(拓樸資料庫):利用Topology Database中的資訊,計算出抵達每個網路的最短路徑。
7.LSA(Link State Advertisement連結狀態宣傳):LSA是一種OSPF資料封包,用來更新、維護Topology Database,OSPF只會與有緊鄰關係的Router交換LSA封包。
8.DR(Designated Router委任路由器):在所有可以形成緊鄰關係的Router中,挑選出一個代表,負責接受路由更新資訊,並廣播更新資訊給其餘的Router,確保所有資料庫同步,所有Router都會與DR建立緊鄰關係,而不是雜亂無章的隨意建立。
DR的產生,以優先權最高的RRouter取得,若相同,則以RID越高者優先取得DR。
9.BDR(Backup Designated Router備用委任路由器):產生方式與DR相同,第二優先權者為BDR,接收路由更新,但是不廣播更新資料,當DR故障時,取而代之。
DR與BDR的選舉
1.Router必須有介面屬於相同網段,並且有相同的Area ID。
2.相同的Hello Interval與Dead Interval(Hello與死亡時間間隔)。
3.相同的驗證碼(如有設定時)。
CISCO建議設定OSPF時,要使用LookBack Interface,可以提升OSPF運作的穩定性。
每台Router的LookBack IP Address必須屬於不同網段並且IP不能重複即可,因此LookBack Interface的Subnet Mask設定為255.255.255.255,就只要注意IP不要重複即可。
Router-2(config)#router ospf 1
Router-2(config-router)#network 192.168.0.0 255.255.255.0 area 0
Router-2(config-router)#network 10.1.1.0 255.255.255.248 area 0
Router-2#sh ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
Gateway of last resort is not set
10.0.0.0/29 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/1
C 192.168.0.0/24 is directly connected, FastEthernet0/0
192.168.1.0/25 is subnetted, 2 subnets
O 192.168.1.0 [110/2] via 10.1.1.1, 00:02:45, FastEthernet0/1
O 192.168.1.128 [110/2] via 10.1.1.2, 00:01:19, FastEthernet0/1
Router-2#sh ip route ospf
192.168.1.0/25 is subnetted, 2 subnets
O 192.168.1.0 [110/2] via 10.1.1.1, 00:02:54, FastEthernet0/1
O 192.168.1.128 [110/2] via 10.1.1.2, 00:01:29, FastEthernet0/1
Router-2#sh ip ospf
Routing Process "ospf 1" with ID 192.168.0.254
Supports only single TOS(TOS0) routes
Supports opaque LSA
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
Number of external LSA 0. Checksum Sum 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 2
Area has no authentication
SPF algorithm executed 6 times
Area ranges are
Number of LSA 4. Checksum Sum 0x03d25b
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
Router-2#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.126 1 FULL/DR 00:00:31 10.1.1.1 FastEthernet0/1
192.168.1.254 1 FULL/DROTHER 00:00:30 10.1.1.2 FastEthernet0/1
Router-2#sh ip ospf database
OSPF Router with ID (192.168.0.254) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
192.168.0.254 192.168.0.254 744 0x80000004 0x00feff 2
192.168.1.126 192.168.1.126 745 0x80000006 0x00feff 2
192.168.1.254 192.168.1.254 657 0x80000004 0x00feff 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.1.1.1 192.168.1.126 658 0x80000003 0x00d55e
Router-2#sh ip ospf interface
FastEthernet0/0 is up, line protocol is up
Internet address is 192.168.0.254/24, Area 0
Process ID 1, Router ID 192.168.0.254, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 192.168.0.254, Interface address 192.168.0.254
No backup designated router on this network
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:04
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
FastEthernet0/1 is up, line protocol is up
Internet address is 10.1.1.3/29, Area 0
Process ID 1, Router ID 192.168.0.254, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 192.168.1.126, Interface address 10.1.1.1
Backup Designated Router (ID) 192.168.0.254, Interface address 10.1.1.3
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:05
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 192.168.1.126 (Designated Router)
Adjacent with neighbor 192.168.1.254
Suppress hello for 0 neighbor(s)
沒有留言:
張貼留言