配置as100与as200之间的ebgp连接
[Huawei]sy
[Huawei]sysname r1
[r1]un in en
[r1]int e0/0/0
[r1-Ethernet0/0/0]ip add 192.168.8.1 24
[r1-Ethernet0/0/0]un sh
[r1-Ethernet0/0/0]int e0/0/1
[r1-Ethernet0/0/1]ip add 192.168.1.2 24
[r1-Ethernet0/0/1]un sh
[r1]bgp 100
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 192.168.1.1 as-number 200
[r1-bgp]ipv4
[r1-bgp]ipv4-family unicast
[r1-bgp-af-ipv4]net
[r1-bgp-af-ipv4]network 192.168.8.0 255.255.255.0
这里不要在confederate peer-as 命令加入r3 所属的子as号 因为r2和r3 之间没有直接连接 另外r2不是asbr 所以不需要配置修改来自r4的路由下一跳为自己的出接口
[Huawei]sy
[Huawei]sysname r2
[r2]un ine
[r2]un in en
[r2]int e0/0/0
[r2-Ethernet0/0/0]ip add 192.168.2.2 24
[r2-Ethernet0/0/0]un sh
[r2-Ethernet0/0/0]q
[r2]bgp 65002
[r2-bgp]router-id 2.2.2.2
[r2-bgp]confederation id 200
[r2-bgp]confederation peer-as 65001
[r2-bgp]peer 192.168.2.1 as-number 65001
[Huawei]sy r3
[r3]
[r3]int e0/0/0
[r3-Ethernet0/0/0]ip add 192.168.3.2 24
[r3-Ethernet0/0/0]un sh
[r3-Ethernet0/0/0]int e0/0/1
[r3-Ethernet0/0/1]ip add 192.168.7.2 24
[r3-Ethernet0/0/1]un sh
Info: Interface Ethernet0/0/1 is not shutdown.
[r3-Ethernet0/0/1]q
[r3]bgp 65003
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 200
[r3-bgp]confederation peer-as 65001
[r3-bgp]peer 192.168.3.1 as-number 65001
[Huawei]sy r4
[r4]un ine
[r4]un in en
[r4]int e0/0/1
[r4-Ethernet0/0/1]ip add 192.168.2.1 24
[r4-Ethernet0/0/1]int e0/0/0
[r4-Ethernet0/0/0]ip add 192.168.1.1 24
[r4-Ethernet0/0/0]un sh
[r4-Ethernet0/0/0]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.3.1 24
[r4-GigabitEthernet0/0/0]un sh
[r4-GigabitEthernet0/0/0]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.4.1 24
[r4-GigabitEthernet0/0/2]un sh
[r4-GigabitEthernet0/0/2]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.5.1 24
[r4-GigabitEthernet0/0/1]un sh
[r4-GigabitEthernet0/0/1]q
[r4]bgp 65001
[r4-bgp]router-id 4.4.4.4
[r4-bgp]confederation id 200(配置联盟id200)
[r4-bgp]confederation peer 65002 65003(指定与65001 属于同一个联盟的还有65002 65003)
[r4-bgp]peer 192.168.2.2 as-number 65002(指定r2为r4的ebgp对等体)
[r4-bgp]peer 192.168.3.2 as-number 65003(指定r3为r4的ebgp对等体)
[r4-bgp]ipv4
[r4-bgp-af-ipv4]peer 192.168.2.2 next-hop-local(指定再向r2进行路由发布吧下一跳设为自己的出接口ip地址)
[r4-bgp-af-ipv4]peer 192.168.3.2 next-hop-local
[r4-bgp-af-ipv4]q
[r4-bgp]peer 192.168.4.2 as-number 65001
[r4-bgp]peer 192.168.5.2 as-number 65001
[r4-bgp]ipv4
[r4-bgp]ipv4-family unicast
[r4-bgp-af-ipv4]peer 192.168.4.2 next-hop-local
[r4-bgp-af-ipv4]peer 192.168.5.2 next-hop-local
[r4-bgp-af-ipv4]q
[r4-bgp]peer 192.168.1.2 as-number 100
[Huawei]sy r5
[r5]un in en
[r5]int e0/0/0
[r5-Ethernet0/0/0]ip add 192.168.7.1 24
[r5-Ethernet0/0/0]un sh
[r5-Ethernet0/0/0]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.4.2 24
[r5-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[r5-GigabitEthernet0/0/0]int e0/0/1
[r5-Ethernet0/0/1]ip add 192.168.6.2 24
[r5-Ethernet0/0/1]un sh
[r5-Ethernet0/0/1]q
[r5]bgp 65001
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 192.168.4.1 as-number 65001
[r5-bgp]peer 192.168.6.1 as-number 65001
[Huawei]sy r6
[r6]int e0/0/1
[r6-Ethernet0/0/1]ip add 192.168.5.2 24
[r6-Ethernet0/0/1]un sh
Info: Interface Ethernet0/0/1 is not shutdown.
[r6-Ethernet0/0/1]int e0/0/0
[r6-Ethernet0/0/0]ip add 192.168.6.1 24
[r6-Ethernet0/0/0]un sh
Info: Interface Ethernet0/0/0 is not shutdown.
[r6-Ethernet0/0/0]q
[r6]bgp 65001
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 200
[r6-bgp]peer 192.168.5.1 as-number 65001
[r6-bgp]peer 192.168.6.2 as-number 65001
配置好后 可以通过display bgp routing-table 192.168.8.0 命令查看r2的bgp路由表
可以发现r2已学习到为与r1的192.168.8.0网络的路由