Track與nqa聯動 VS 靜態路由優先級相同
有蠻長一段時間沒有寫博客了,下面就來說一下Track與nqa聯動 VS 靜態路由優先級相同的情況,也不知道對不對,請指正!請看下圖:
說明:SWA是機房1的,SWB是機房2的,SWC是某銀行的,A到B是truck直連,其他是access,C到A時電信專線,C到B是聯通專線;A-B-C-PC2和A-C-PC2是互爲備份線路。另:圖示是GigabitEthernet口,實際配置用Ethernet
SWA配置:
[SWA]interface Ethernet 0/4/0
[SWA-Ethernet0/4/0]port link-type trunk
[SWA-Ethernet0/4/0]port trunk permit vlan all
[SWA]vlan 2
[SWA]interface Vlan-interface 2
[SWA-Vlan-interface2]ip address 10.1.1.1 24
[SWA-Ethernet0/4/1]port link-type access
[SWA-vlan4]port e0/4/1
[SWA-Vlan-interface4]ip address 30.1.1.1 24
[SWA-Ethernet0/4/2]port link-type access
[SWA-vlan5]port e0/4/2
[SWA-Vlan-interface5]ip address 50.1.1.1 24
SWB與SWC同上相似的配置。
PC1 : 50.1.1.2 255.255.255.0 50.1.1.1
PC2 : 60.1.1.2 255.255.255.0 60.1.1.1
首先,我們來看靜態路由優先級相同的情況
PC1-SWA-SWC-PC2線路
SWA上配置,目的地址:60.1.1.2/24,下一跳:30.1.1.2/24 ,優先級preference默認60
[SWA]ip route-static 60.1.1.2 24 30.1.1.2
SWC上配置,目的地址:50.1.1.2/24,下一跳:30.1.1.1/24 ,優先級preference默認60
[SWC]ip route-static 50.1.1.2 24 30.1.1.1
[SWC]ping 50.1.1.2
PING 50.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 50.1.1.2: bytes=56 Sequence=1 ttl=63 time=44 ms
Reply from 50.1.1.2: bytes=56 Sequence=2 ttl=63 time=24 ms
Reply from 50.1.1.2: bytes=56 Sequence=3 ttl=63 time=25 ms
[SWA]display ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan2
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
30.1.1.0/24 Direct 0 0 30.1.1.1 Vlan4
30.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
50.1.1.0/24 Direct 0 0 50.1.1.1 Vlan5
50.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
60.1.1.0/24 Static 60 0 30.1.1.2 Vlan4
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
[SWC]display ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
20.1.1.0/24 Direct 0 0 20.1.1.2 Vlan3
20.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
30.1.1.0/24 Direct 0 0 30.1.1.2 Vlan4
30.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
50.1.1.0/24 Static 60 0 30.1.1.1 Vlan4
60.1.1.0/24 Direct 0 0 60.1.1.1 Vlan6
60.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
PC1-SWA-SWB-SWC-PC2線路
SWA上配置,目的地址:60.1.1.2/24,下一跳:10.1.1.2/24 ,優先級preference還是默認60
[SWA]ip route-static 60.1.1.2 24 10.1.1.2
[SWA]dis ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 10
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 Direct 0 0 10.1.1.1 Vlan2
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
30.1.1.0/24 Direct 0 0 30.1.1.1 Vlan4
30.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
50.1.1.0/24 Direct 0 0 50.1.1.1 Vlan5
50.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
60.1.1.0/24 Static 60 0 30.1.1.2 Vlan4
Static 60 0 10.1.1.2 Vlan2
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
SWC上配置,目的地址:50.1.1.2/24,下一跳:20.1.1.1/24 ,優先級preference也還是默認60
[SWC]ip route-static 50.1.1.2 24 20.1.1.1
[SWC]dis ip routing-table
Routing Tables: Public
Destinations : 9 Routes : 10
Destination/Mask Proto Pre Cost NextHop Interface
20.1.1.0/24 Direct 0 0 20.1.1.2 Vlan3
20.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
30.1.1.0/24 Direct 0 0 30.1.1.2 Vlan4
30.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
50.1.1.0/24 Static 60 0 30.1.1.1 Vlan4
Static 60 0 20.1.1.1 Vlan3
60.1.1.0/24 Direct 0 0 60.1.1.1 Vlan6
60.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
在兩條線路都有靜態路由的情況下,由於SWB還沒有靜態路由,所以會出現丟包,還有防止環路
SWB上配置靜態路由:
SWB-PC1線路
[SWB]ip route-static 50.1.1.2 24 10.1.1.1
SWB-PC2線路
[SWB]ip route-static 60.1.1.2 24 20.1.1.2
[SWB]dis ip routing-table
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 Direct 0 0 10.1.1.2 Vlan2
10.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
20.1.1.0/24 Direct 0 0 20.1.1.1 Vlan3
20.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
50.1.1.0/24 Static 60 0 10.1.1.1 Vlan2
60.1.1.0/24 Static 60 0 20.1.1.2 Vlan3
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
當兩條線路優先級都是一樣的時候,關閉SWA或者SWC其中的一個接口,另一條線路是通的,因爲是交互的
[SWA-Vlan-interface4]shutdown
50.1.1.2 icmp_seq=497 ttl=61 time=40.000 ms
50.1.1.2 icmp_seq=498 ttl=61 time=30.000 ms
50.1.1.2 icmp_seq=499 ttl=61 time=50.000 ms
50.1.1.2 icmp_seq=500 ttl=61 time=30.000 ms
50.1.1.2 icmp_seq=501 ttl=61 time=40.000 ms
Track與nqa聯動的情況,必須兩邊都配置聯動,如果只有一邊,那麼只能探測到對端的線路是否聯通。
PC1-SWA-SWC-PC2線路
SWA上配置,目的地址:60.1.1.2/24,下一跳:30.1.1.2/24 ,優先級默認60,該路由與
Track 項 1關聯。
[SWA]ip route-static 60.1.1.2 24 30.1.1.2 track 1
PC1-SWA-SWB-SWC-PC2線路
SWA上配置,目的地址:60.1.1.2/24,下一跳:10.1.1.2/24 ,優先級preference是70
[SWA]ip route-static 60.1.1.2 24 10.1.1.2 preference 70
[SWA]nqa entry admin dianxin
[SWA-nqa-admin-dianxin]type icmp-echo
[SWA-nqa-admin-dianxin-icmp-echo]destination ip 30.1.1.2
[SWA-nqa-admin-dianxin-icmp-echo]frequency 100
[SWA-nqa-admin-dianxin-icmp-echo]reaction 1 checked-element probe-fail threshold-type consecutive 5 action-type trigger-only
[SWA-nqa-admin-dianxin-icmp-echo]quit
[SWA]nqa schedule admin dianxin start-time now lifetime forever
[SWA]track 1 nqa entry admin dianxin reaction 1
[SWA]dis track all
Track ID: 1
Status: Positive
Duration: 0 days 0 hours 0 minutes 15 seconds
Notification delay: Positive 0, Negative 0 (in seconds)
Reference object:
NQA entry: admin dianxin
Reaction: 1
同上,SWC上配置類似SWA,這樣可以互相探測對方的線路的聯通性。
例如:關閉SWC其中的一個端口,track就可以啓動另一條備份線路了
[SWC-Vlan-interface4]shutdown
[SWC-Vlan-interface4]
%Apr 27 22:30:49:220 2014 SWC IFNET/3/LINK_UPDOWN: Vlan-interface4 link status is DOWN.
%Apr 27 22:30:49:220 2014 SWC IFNET/5/LINEPROTO_UPDOWN: Line protocol on the interface Vlan-interface4 is DOWN.
[SWC-Vlan-interface4]
[SWC-Vlan-interface4]display ip routing-table
Routing Tables: Public
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost NextHop Interface
20.1.1.0/24 Direct 0 0 20.1.1.2 Vlan3
20.1.1.2/32 Direct 0 0 127.0.0.1 InLoop0
50.1.1.0/24 Static 70 0 20.1.1.1 Vlan3
60.1.1.0/24 Direct 0 0 60.1.1.1 Vlan6
60.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0