1,配置IP地址
[R1]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.1.1.1/24 up up
LoopBack0 192.168.1.1/24 up up(s)
[R2]dis ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.1.1.2/24 up up
GigabitEthernet0/0/1 100.2.2.2/24 up up
LoopBack0 2.2.2.2/32 up up(s)
[R3]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.2.2.3/24 up up
GigabitEthernet0/0/1 100.3.3.3/24 up up
LoopBack0 3.3.3.3/32 up up(s)
[R4]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.3.3.4/24 up up
GigabitEthernet0/0/1 100.4.4.4/24 up up
LoopBack0 4.4.4.4/32 up up(s)
[R5]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.4.4.5/24 up up
LoopBack0 192.168.2.5/24 up up(s)
2,内网通过OSPF协议搞通
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]net
[R2-ospf-1-area-0.0.0.0]network 100.2.2.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 100.2.2.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 100.3.3.0 0.0.0.255
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 0
[R4-ospf-1-area-0.0.0.0]network 100.3.3.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
3,R1,R2,R4,R5运行BGP,R1和R2建立EBGP邻居;
R4和R5建立EBGP邻居,R2和R4建立IBGP邻居;
要求EBGP邻居使用直连接口建立邻居,IBGP邻居使用环回口 建立邻居;
[R1]bgp 100
[R1-bgp]peer 100.1.1.2 as-number 200
[R2]bgp 200
[R2-bgp]peer 100.1.1.1 as-number 100
[R2]bgp 200
[R2-bgp]peer 4.4.4.4 as-number 200
[R2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R2-bgp]peer 4.4.4.4 next-hop-local
[R4]bgp 200
[R4-bgp]peer 2.2.2.2 as-number 200
[R4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R4-bgp]peer 2.2.2.2 next-hop-local
[R4]bgp 200
[R4-bgp]peer 100.4.4.5 as-number 300
[R5]bgp 300
[R5-bgp]peer 100.4.4.4 as-number 200
4,R1和R5把业务网段置告进BGP。
[R1]bgp 100
[R1-bgp]network 192.168.1.0 24
[R5]bgp 300
[R5-bgp]network 192.168.2.0 24
5,在R2和R4上把BGP引入到IGP解决BGP路由黑洞问题。
[R2-ospf-1]import-route bgp
[R4-ospf-1]import-route bgp
—— 在R1上必须通过-a操作指定哪一个地址ping,因为其他地址没有倍宣告进bgp
协议