九、华为路由器配置:BGP协议
程序员文章站
2024-03-20 22:02:34
...
关于BGP协议的原理和相关信息,参考下面的链接
https://blog.csdn.net/keith6785753/article/details/107088632
1、实验拓扑
2、R3配置计划节点地址
R3是网络的中心,首先必须在R3上面把各节点的地址先加上去,要不然后面的步骤没法进行。
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]int s2/0/0
[R3-Serial2/0/0]ip add 10.0.0.2 8
[R3-Serial2/0/0]
Oct 20 2020 12:42:09-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
IPCP on the interface Serial2/0/0 has entered the UP state.
[R3-Serial2/0/0]int s2/0/1
[R3-Serial2/0/1]ip add 20.0.0.2 8
[R3-Serial2/0/1]int s1/0/0
[R3-Serial1/0/0]ip add 30.0.0.2 8
[R3-Serial1/0/0]int s1/0/1
[R3-Serial1/0/1]ip add 40.0.0.2 8
[R3-Serial1/0/1]
3、R1的配置
[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add
[R1-GigabitEthernet0/0/0]ip address 192.168.1.2 24
Oct 20 2020 12:37:58-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]int s2/0/0
[R1-Serial2/0/0]ip add 10.0.0.1 8
[R1-Serial2/0/0]q
[R1]bgp 100 #范围编号
[R1-bgp]router-id 10.0.0.1 #router-id就以端口的IP
[R1-bgp]peer 10.0.0.2 as-number 300 #对端的范围编号
[R1-bgp]network 192.168.1.0 #添加两端的网段
[R1-bgp]network 10.0.0.0 #添加两端的网段
[R1-bgp]
4、R2的配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.2.2 24
Oct 20 2020 12:51:25-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]int s2/0/0
[R2-Serial2/0/0]ip add 20.0.0.1 8
[R2-Serial2/0/0]
Oct 20 2020 12:51:47-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP
IPCP on the interface Serial2/0/0 has entered the UP state.
[R2-Serial2/0/0]
[R2-Serial2/0/0]q
[R2]bgp 200
[R2-bgp]router-id 20.0.0.1
[R2-bgp]peer 20.0.0.2 as-n
[R2-bgp]peer 20.0.0.2 as-number 300
[R2-bgp]network 192.168.2.0
[R2-bgp]network 20.0.0.0
5、R3配置bgp
[R3-bgp]router-id 10.0.0.2
[R3-bgp]peer 10.0.0.1 as-number 100
[R3-bgp]peer 20.0.0.1 as-number 200
[R3-bgp]peer 30.0.0.1 as-number 400
[R3-bgp]peer 40.0.0.1 as-number 500
[R3-bgp]
这里如果填错了,可以使用undo peer 40.0.0.1
命令删除。我在这里配置时弹出了提示信息,所以打错了
6、R4的配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.3.2 24
[R4-GigabitEthernet0/0/0]
Oct 20 2020 12:55:27-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R4-GigabitEthernet0/0/0]int s2/0/0
[R4-Serial2/0/0]ip add 30.0.0.1 8
[R4-Serial2/0/0]
Oct 20 2020 12:55:44-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP
IPCP on the interface Serial2/0/0 has entered the UP state.
[R4-Serial2/0/0]q
[R4]bgp 400
[R4-bgp]router-id 30.0.0.1
[R4-bgp]peer 30.0.0.2 as-n
[R4-bgp]peer 30.0.0.2 as-number 300
[R4-bgp]network 192.168.3.0
[R4-bgp]network 30.0.0.0
[R4-bgp]
7、R5的配置
Please press enter to start cmd line!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R5
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 192.168.4.2 24
Oct 20 2020 12:58:37-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R5-GigabitEthernet0/0/0]int s2/0/0
[R5-Serial2/0/0]ip add 40.0.0.1 8
[R5-Serial2/0/0]
Oct 20 2020 12:59:15-08:00 R5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP
IPCP on the interface Serial2/0/0 has entered the UP state.
[R5-Serial2/0/0]q
[R5]bgp 500
[R5-bgp]router-id 40.0.0.1
[R5-bgp]peer 40.0.0.2 as-n
[R5-bgp]peer 40.0.0.2 as-number 300
[R5-bgp]network 40.0.0.0
[R5-bgp]network 192.168.4.0
[R5-bgp]
8、验证结果
在PC1 上面分别ping 其他PC
PC>ping 192.168.4.1
Ping 192.168.4.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.4.1: bytes=32 seq=2 ttl=125 time=15 ms
From 192.168.4.1: bytes=32 seq=3 ttl=125 time=16 ms
From 192.168.4.1: bytes=32 seq=4 ttl=125 time=31 ms
From 192.168.4.1: bytes=32 seq=5 ttl=125 time=31 ms
--- 192.168.4.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/23/31 ms
PC>ping 192.168.2.1
Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.1: bytes=32 seq=2 ttl=125 time=16 ms
From 192.168.2.1: bytes=32 seq=3 ttl=125 time=15 ms
--- 192.168.2.1 ping statistics ---
3 packet(s) transmitted
2 packet(s) received
33.33% packet loss
round-trip min/avg/max = 0/15/16 ms
PC>ping 192.168.3.1
Ping 192.168.3.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.3.1: bytes=32 seq=2 ttl=125 time=15 ms
From 192.168.3.1: bytes=32 seq=3 ttl=125 time=16 ms
From 192.168.3.1: bytes=32 seq=4 ttl=125 time=31 ms
From 192.168.3.1: bytes=32 seq=5 ttl=125 time=31 ms
--- 192.168.3.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/23/31 ms
上一篇: [Maven]私服Nexus搭建
下一篇: hcl 常见的几个问题