mpls mpls ldp #
interface Ethernet0/0/1 mpls mpls ldp
R3:
MPLS LSR 3.3.3.3 MPLS MPLS LDP #
[R3]interface Ethernet0/0/0 [R3-Ethernet0/0/0]mpls [R3-Ethernet0/0/0]mpls ldp
然后在R3上查看关于5.5.5.5这条路由信息:
[R3]display bgp vpnv4 all routing-table BGP Local router ID is 192.168.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total number of routes from all PE: 1 Route Distinguisher: 30:30
Network NextHop MED LocPrf PrefVal Path/Ogn *>i 5.5.5.5/32 1.1.1.1 0 100 0 500i
VPN-Instance site-b, Router ID 192.168.2.2: Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn *>i 5.5.5.5/32 1.1.1.1 0 100 0 500i 7.完成R3—R7之间的配置(略) 配置完成后,在R3上查看BGP VPNV4路由 [R3]display bgp vpnv4 all routing-table BGP Local router ID is 192.168.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total number of routes from all PE: 2 Route Distinguisher: 30:30
Network NextHop MED LocPrf PrefVal Path/Ogn *>i 5.5.5.5/32 1.1.1.1 0 100 0 500i *> 7.7.7.7/32 192.168.6.2 0 0 700i
VPN-Instance site-b, Router ID 192.168.2.2:
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn *>i 5.5.5.5/32 1.1.1.1 0 100 0 500i *> 7.7.7.7/32 192.168.6.2 0 0 700i
在R7上 进行ping测试ping 5.5.5.5 [R7-bgp]ping 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break Request time out Request time out
--- 5.5.5.5 ping statistics --- 2 packet(s) transmitted 0 packet(s) received 100.00% packet loss
通过测试发现PING 5.5.5.5不通,带上源地址ping 却能通; [R7-bgp]ping -a 7.7.7.7 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=253 time=210 ms Reply from 5.5.5.5: bytes=56 Sequence=2 ttl=253 time=110 ms Reply from 5.5.5.5: bytes=56 Sequence=3 ttl=253 time=170 ms Reply from 5.5.5.5: bytes=56 Sequence=4 ttl=253 time=110 ms Reply from 5.5.5.5: bytes=56 Sequence=5 ttl=253 time=100 ms --- 5.5.5.5 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss
round-trip min/avg/max = 100/140/210 ms
PING 7.7.7.7: 56 data bytes, press CTRL_C to break
Reply from 7.7.7.7: bytes=56 Sequence=1 ttl=253 time=130 ms Reply from 7.7.7.7: bytes=56 Sequence=2 ttl=253 time=80 ms Reply from 7.7.7.7: bytes=56 Sequence=3 ttl=253 time=110 ms --- 7.7.7.7 ping statistics --- 3 packet(s) transmitted 3 packet(s) received 0.00% packet loss
round-trip min/avg/max = 80/106/130 ms
这是为什么呢?因为我们直接PING 的话是相当于带着源地址为接口地址PING的,由于接口IP地址和5.5.5.5路由不通;
那么怎么办呢?这时候就需要把直连vpn的接口的路由给发布出去,我们在R1上可以做network也可以做import方式;
在现网实际操作中会有很多路由地址段需要发布,我们假如要做的话就需要手工的方式进行network,工作量较大,这里我们采用import的方式进行引入; [R1]bgp 100
[R1-bgp] ipv4-family vpn-instance site-b [R1-bgp-site-b]import-route direct
[R3]bgp 100
[R3-bgp] ipv4-family vpn-instance site-b [R3-bgp-site-b]import-route direct
另附上network的方式: [R1] bgp 100
ipv4-family vpn-instance site-b network 192.168.4.0 255.255.255.252 peer 192.168.4.2 as-number 500 [R3] bgp 100
ipv4-family vpn-instance site-b network 192.168.6.0 255.255.255.252 peer 192.168.6.2 as-number 700 做完之后我们可以PING测试下:
[R1]ping -vpn-instance site-b 192.168.6.1
PING 192.168.6.1: 56 data bytes, press CTRL_C to break Reply from 192.168.6.1: bytes=56 Sequence=1 ttl=254 time=100 ms Reply from 192.168.6.1: bytes=56 Sequence=2 ttl=254 time=50 ms Reply from 192.168.6.1: bytes=56 Sequence=3 ttl=254 time=60 ms Reply from 192.168.6.1: bytes=56 Sequence=4 ttl=254 time=70 ms Reply from 192.168.6.1: bytes=56 Sequence=5 ttl=254 time=80 ms --- 192.168.6.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss
round-trip min/avg/max = 50/72/100 ms
[R1]ping -vpn-instance site-b 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=255 time=30 ms Reply from 5.5.5.5: bytes=56 Sequence=2 ttl=255 time=60 ms Reply from 5.5.5.5: bytes=56 Sequence=3 ttl=255 time=30 ms --- 5.5.5.5 ping statistics --- 3 packet(s) transmitted 3 packet(s) received 0.00% packet loss
round-trip min/avg/max = 30/40/60 ms
[R1]ping -vpn-instance site-b 7.7.7.7
PING 7.7.7.7: 56 data bytes, press CTRL_C to break
Reply from 7.7.7.7: bytes=56 Sequence=1 ttl=254 time=130 ms Reply from 7.7.7.7: bytes=56 Sequence=2 ttl=254 time=90 ms Reply from 7.7.7.7: bytes=56 Sequence=3 ttl=254 time=60 ms Reply from 7.7.7.7: bytes=56 Sequence=4 ttl=254 time=130 ms Reply from 7.7.7.7: bytes=56 Sequence=5 ttl=254 time=70 ms --- 7.7.7.7 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss
round-trip min/avg/max = 60/96/130 ms
[R5]ping 7.7.7.7
PING 7.7.7.7: 56 data bytes, press CTRL_C to break
Reply from 7.7.7.7: bytes=56 Sequence=1 ttl=253 time=110 ms Reply from 7.7.7.7: bytes=56 Sequence=2 ttl=253 time=70 ms Reply from 7.7.7.7: bytes=56 Sequence=3 ttl=253 time=90 ms Reply from 7.7.7.7: bytes=56 Sequence=4 ttl=253 time=100 ms Reply from 7.7.7.7: bytes=56 Sequence=5 ttl=253 time=110 ms --- 7.7.7.7 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss
round-trip min/avg/max = 70/96/110 ms
7. 完成R1—R4之间的配置(略) [R1-ospf-2]dis this #
ospf 2 vpn-instance site-a area 0.0.0.0
network 192.168.3.0 0.0.0.3 8.
network 192.168.3.0 0.0.0.3 network 4.4.4.4 0.0.0.0
同理在R1做完后需要将OSPF路由引入到BGP VPN实例中,生成BGP VPNV4路由信息: [R1] bgp 100
ipv4-family vpn-instance site-a import-route ospf 2
引入之后我们在R1上查看关于R4的BGP VPNV4 路由
[R1-bgp-site-a]display bgp vpnv4 vpn-instance site-a routing-table BGP Local router ID is 192.168.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete VPN-Instance site-a, Router ID 192.168.1.1: Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn *> 4.4.4.4/32 0.0.0.0 2 0 ? *> 192.168.3.0/30 0.0.0.0 0 0 ?
从这里我们能看到R1学习到了R4的路由(其中包含4.4.4.4和互联接口),并生成了BGP VPNV4路由信息;
9. 完成R3—R6之间的配置(static路由方式) 在R3上指示静态路由方式打通VPNV4 路由;
[R3]ip route-static vpn-instance site-a 6.6.6.6 255.255.255.255 192.168.5.2 配置完成后在R3上应该能看到关于6.6.6.6的vpnv4路由 [R3]display ip routing-table vpn-instance site-a Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------ Routing Tables: site-a
Destinations : 3 Routes : 3
Destination/Mask Proto Pre Cost Flags NextHop Interface
6.6.6.6/32 Static 60 0 RD 192.168.5.2 Ethernet0/0/1 192.168.5.0/30 Direct 0 0 D 192.168.5.1 Ethernet0/0/1 192.168.5.1/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/1 然后在R3上将这条路由变成BGP VPNV4路由; [R3] BGP 100
ipv4-family vpn-instance site-a import-route static
完成后在R3上就能看见关于R6的bgp vpnv4路由信息;
[R3-bgp-site-a]display bgp vpnv4 vpn-instance site-a routing-table
BGP Local router ID is 192.168.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete VPN-Instance site-a, Router ID 192.168.2.2: Total Number of Routes: 3
Network NextHop MED LocPrf PrefVal Path/Ogn