IP sla(service level agreement)服务等级协议,可以实时的收集ip网络的各种信息,包括latency、jitter、packet loss,连通性等。本文主要介绍sla在connectivity上的应用。在连通性检查上,可以说是BFD的升级版,BFD只能检测同一网段内的链路联通行,sla则可以跨网段。IP-SLA是思科私有协议,华为NQA与之对标。
interface Loopback3 ip address 3.3.3.3 255.255.255.0 ip ospf 110 area 0 ! interface Ethernet0/0 switchport trunk encapsulation dot1q switchport mode trunk ! interface Ethernet0/1 no switchport ip address 35.1.1.3 255.255.255.0 ip ospf 110 area 0 ! interface Ethernet0/2 switchport trunk encapsulation dot1q switchport mode trunk ! interface Vlan10 ip address 192.168.1.3 255.255.255.0 ip ospf 110 area 0 ! router ospf 110
1 2 3 4 5 6 7 8 9 10 11 12 13
interface Loopback0 ip address 4.4.4.4 255.255.255.255 ip ospf 110 area 0 ! interface Ethernet0/0 ip address 24.1.1.4 255.255.255.0 ip ospf 110 area 0 duplex auto ! interface Ethernet0/1 ip address 47.1.1.4 255.255.255.0 ip ospf 110 area 0 duplex auto
1 2 3 4 5 6 7 8 9 10 11 12 13
interface Loopback0 ip address 5.5.5.5 255.255.255.255 ip ospf 110 area 0 ! interface Ethernet0/0 ip address 35.1.1.5 255.255.255.0 ip ospf 110 area 0 duplex auto ! interface Ethernet0/1 ip address 57.1.1.5 255.255.255.0 ip ospf 110 area 0 duplex auto
1 2 3 4 5 6 7 8 9 10 11 12 13
interface Loopback0 ip address 7.7.7.7 255.255.255.0 ip ospf 110 area 0 ! interface Ethernet0/0 ip address 47.1.1.7 255.255.255.0 ip ospf 110 area 0 duplex auto ! interface Ethernet0/1 ip address 57.1.1.7 255.255.255.0 ip ospf 110 area 0 duplex auto
interface Vlan10 vrrp 1 ip 192.168.1.1 // S3上面配置vrrp,使其成为backup
查看vrrp的基本信息:
1 2 3 4 5 6 7
S2#show vrrp brief Interface Grp Pri Time Own Pre State Master addr Group addr Vl10 1 150 3414 Y Master 192.168.1.2 192.168.1.1
在vpc上测试网关是否可达: VPCS> ping 192.168.1.1 -c 1 84 bytes from 192.168.1.1 icmp_seq=1 ttl=255 time=0.435 ms
NAT配置如下,这里做一个简单的nat配置,复用出端口ip。
1 2 3 4 5 6 7 8 9 10
ip access-list standard NAT permit 192.168.1.0 0.0.0.255 // 创建acl,匹配192.168.1.0网段的ip
ip nat inside source list NAT interface Ethernet0/1 overload //创建nat,转换source,匹配NAT的acl,复用eth0/0的IP地址
interface Ethernet0/0 ip nat inside // 确定source,dest
interface Ethernet0/1 ip nat outside // 确定source,dest
R5上的NAT配置和R4一模一样,完成之后vpc就可以ping通7.7.7.7了。
1 2 3 4 5 6 7
VPCS> ping 7.7.7.7 -c 1 84 bytes from 7.7.7.7 icmp_seq=1 ttl=253 time=1.043 ms
在R4上查看NAT转换: R4#show ip nat translations Pro Inside global Inside local Outside local Outside global icmp 47.1.1.4:36346 192.168.1.10:36346 7.7.7.7:36346 7.7.7.7:36346
S2#show ip sla summary | begin ID ID Type Destination Stats Return Last (ms) Code Run ----------------------------------------------------------------------- *1 icmp-echo 4.4.4.4 RTT=1 OK 1 second ago
S2#show track 1 Track 1 IP SLA 1 state State is Up 7 changes, last change 00:08:26 Latest operation return code: OK Latest RTT (millisecs) 1 Tracked by: VRRP Vlan10 1
现在将R4关机,查看sla的状态信息以及vrrp的状态信息:
1 2 3 4 5 6 7 8 9
S2#show ip sla summary | begin ID ID Type Destination Stats Return Last (ms) Code Run ----------------------------------------------------------------------- *1 icmp-echo 4.4.4.4 - Timeout 12 seconds ag
S2#show vrrp brief Interface Grp Pri Time Own Pre State Master addr Group addr Vl10 1 90 3414 Y Backup 192.168.1.3 192.168.1.1