BGP实验
实验:
[H3C]sysn r1
[r1]int g0/0
[r1-GigabitEthernet0/0]ip add 192.168.1.1 24
[H3C]sysn r2
[r2]int g0/0
[r2-GigabitEthernet0/0]ip add 192.168.1.2 24
[r2-GigabitEthernet0/0]int g0/1
[r2-GigabitEthernet0/1]ip add 192.168.2.1 24
[r2-GigabitEthernet0/1]int lo 0
[r2-LoopBack0]ip add 2.2.2.2 32
[H3C]sysn r3
[r3]int g0/0
[r3-GigabitEthernet0/0]ip add 192.168.2.2 24
[r3-GigabitEthernet0/0]int g0/1
[r3-GigabitEthernet0/1]ip add 192.168.3.1 24
[H3C]sysn rt4
[rt4]int g0/0
[rt4-GigabitEthernet0/0]ip add 192.168.3.2 24
[rt4-GigabitEthernet0/0]int g0/1
[rt4-GigabitEthernet0/1]ip add 192.168.4.1 24
[rt4-GigabitEthernet0/1]int loo 0
[rt4-LoopBack0]ip add 4.4.4.4 32
[H3C]sysn r5
[r5]int g0/0
[r5-GigabitEthernet0/0]ip add 192.168.4.2 24
2、r2 r3 r4配置ospf
r2:
ospf 1
area 0.0.0.0
network 192.168.2.0 0.0.0.255
r3:
ospf 1
area 0.0.0.0
network 192.168.2.0 0.0.0.255
network 192.168.3.0 0.0.0.255
r4:
ospf 1
area 0.0.0.0
network 192.168.3.0 0.0.0.255
3、配置bgp部分
[r1-LoopBack0]bgp 200
[r1-bgp-default]peer 192.168.1.2 as-num 200
[r1-bgp-default]add ipv4 un
[r1-bgp-default-ipv4]peer 192.168.1.2 ena
[r2-ospf-1-area-0.0.0.0]bgp 100
[r2-bgp-default]peer 192.168.1.1 as 200
[r2-bgp-default]peer 4.4.4.4 as 100
[r2-bgp-default]peer 4.4.4.4 connect-interface LoopBack 0
[r2-bgp-default]address-family ipv4 unicast
[r2-bgp-default-ipv4]peer 192.168.1.1 enable
[r2-bgp-default-ipv4]peer 4.4.4.4 enable
[r2-bgp-default-ipv4]peer 4.4.4.4 next-hop-local
[rt4]bgp 100
[rt4-bgp-default]pe 192.168.4.2 as 300
[rt4-bgp-default]pe 2.2.2.2 as 100
[rt4-bgp-default]pe 2.2.2.2 con LoopBack 0
[rt4-bgp-default]add ipv4 un
[rt4-bgp-default-ipv4]pe 192.168.4.2 en
[rt4-bgp-default-ipv4]pe 2.2.2.2 en
[rt4-bgp-default-ipv4]pe 2.2.2.2 next-hop-local
[r5-LoopBack0]bgp 300
[r5-bgp-default]pe 192.168.4.1 as 100
[r5-bgp-default]add ipv4 un
[r5-bgp-default-ipv4]pe 192.168.4.1 en
4、在 R1 和 R5 上把业务网段宣告进 BGP 的 IPv4 地址族模式
[r1-bgp-default-ipv4]bgp 100
[r1-bgp-default]add ipv4 un
[r1-bgp-default-ipv4]netw 192.168.1.0 24
[r5-bgp-default-ipv4]bgp 300
[r5-bgp-default]add ipv4 un
[r5-bgp-default-ipv4]netw 192.168.4.0 24
5、在 R2 和 R4 上分别把 BGP 引入到 OSPF
Ospf 1
[r2-ospf-1]import-route bgp
Ospf 1
[rt4-ospf-1]import-route bgp
6、r2 ospf中引入直连和 r4 ospf中引入直连
ospf 1
import-route direct