BGP/MPLS
实验拓扑:
实验需求:
- 根据图示配置IP地址,配置tunnel口地址
- PE1、PE1、P设备之间运行OSPF保证ISP之间网络互通,公网之间配置MPLS LDP协议,
- CE1、CE3属于vpn1、CE2、CE4属于vpn2、vpna使用的VPN-target属性为100:1,vpnb为200:1,CE1、CE2、CE3、CE4、需要配置RD,用来标识,来自不同的VPN的路由。
- 配置MP-BGP为私网路由打上私网标签。不同VPN用户之间不能互相访问
实验步骤:
- 配置IP地址略
- 配置OSPF使公网互通
PE1:
[PE1]ospf 1 router-id 1.1.1.1
[PE1-ospf-1]area 0
[PE1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[PE1-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
PE2:
[PE2]ospf 1 router-id 3.3.3.3
[PE2-ospf-1]area 0
[PE2-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[PE2-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
P:
ospf 1 router-id 2.2.2.2
[P-ospf-1]area 0
[P-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[P-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[P-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
配置MPLS LDP
- 注意:配置完LDP协议后要在公网接口下调用
PE1:
[PE1]mpls lsr-id 1.1.1.1
[PE1]mpls
[PE1]mpls ldp
[PE1-mpls]quit
[PE1]interface GigabitEthernet0/0/2
[PE1-GigabitEthernet0/0/2]mpls
[PE1-GigabitEthernet0/0/2]mpls ldp
P、PE2配置与配置PE1配置相同略
- 将接口划分到相应的VPN实例中
- 注意:接口要先绑定VPN实例,在配置IP地址
[PE1-GigabitEthernet0/0/0]ip binding vpn-instance vpn1
[PE1-GigabitEthernet0/0/0]ip address 11.1.1.1 255.255.255.0
[PE1-GigabitEthernet0/0/1]ip binding vpn-instance vpn2
[PE1-GigabitEthernet0/0/1]ip address 12.1.1.1 255.255.255.0
PE2配置相同略
3.1配置vpn实例
[PE1]ip vpn-instance vpn1
[PE1-vpn-instance-vpn1] ipv4-family
[PE1-vpn-instance-vpn1-af-ipv4]route-distinguisher 1:1
[PE1-vpn-instance-vpn1-af-ipv4]vpn-target 100:1 both
[PE1]ip vpn-instance vpn2
[PE1-vpn-instance-vpn2] ipv4-family
[PE1-vpn-instance-vpn2-af-ipv4]route-distinguisher 3:3
[PE1-vpn-instance-vpn2-af-ipv4]vpn-target 200:1 both
PE2:
[PE2]ip vpn-instance vpn1
[PE2-vpn-instance-vpn1]ipv4-family
[PE2-vpn-instance-vpn1-af-ipv4]route-distinguisher 2:2
[PE2-vpn-instance-vpn1-af-ipv4]vpn-target 100:1 both
[PE2]ip vpn-instance vpn2
[PE2-vpn-instance-vpn2] ipv4-family
[PE2-vpn-instance-vpn2-af-ipv4]route-distinguisher 4:4
[PE2-vpn-instance-vpn2-af-ipv4]vpn-target 200:1 both
- 配置MP-BGP
PE1:
[PE1-bgp] peer 3.3.3.3 as-number 50
[PE1-bgp] peer 3.3.3.3 connect-interface LoopBack0
[PE1-bgp] ipv4-family vpnv4
[PE1-bgp] policy vpn-target
[PE1-bgp] peer 3.3.3.3 enable
[PE1-bgp]ipv4-family vpn-instance vpn1
[PE1-bgp]import-route direct
[PE1-bgp]peer 11.1.1.2 as-number 10
[PE1-bgp]ipv4-family vpn-instance vpn2
[PE1-bgp]import-route direct
[PE1-bgp]peer 12.1.1.2 as-number 30
CE1:
[CE1] BGP 10
[CE1-bgp]peer 11.1.1.1 as-number 50
CE2:
[CE2]bgp 30
[CE2-bgp]peer 12.1.1.1 as-number 50
PE2:
[PE2]bgp 50
[PE2-bgp]peer 1.1.1.1 as-number 50
[PE2-bgp]peer 1.1.1.1 connect-interface LoopBack0
[PE2-bgp]ipv4-family vpnv4
[PE2-bgp]policy vpn-target
[PE2-bgp]peer 1.1.1.1 enable
[PE2-bgp]ipv4-family vpn-instance vpn1
[PE2-bgp]import-route direct
[PE2-bgp]peer 13.1.1.1 as-number 20
[PE2-bgp]ipv4-family vpn-instance vpn2
[PE2-bgp]import-route direct
[PE2-bgp]peer 14.1.1.1 as-number 40
CE3:
[CE3]BGP 20
[CE3-bgp]peer 13.1.1.2 as-number 50
CE4:
[CE4]BGP 40
[CE4-bgp] peer 14.1.1.2 as-number 50
测试:
<CE1>ping 10.1.2.3
PING 10.1.2.3: 56 data bytes, press CTRL_C to break
Reply from 10.1.2.3: bytes=56 Sequence=1 ttl=252 time=70 ms
Reply from 10.1.2.3: bytes=56 Sequence=2 ttl=252 time=40 ms
Reply from 10.1.2.3: bytes=56 Sequence=3 ttl=252 time=30 ms
Reply from 10.1.2.3: bytes=56 Sequence=4 ttl=252 time=60 ms
Reply from 10.1.2.3: bytes=56 Sequence=5 ttl=252 time=40 ms
<CE1>ping 10.1.2.4
PING 10.1.2.4: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out