接上篇文章:
基本网络拓扑
1、配置各路由端口IP
三层交换机S3的g1/0/1端口改为路由端口
<S3>sys
[S3]interface g1/0/1
[S3-GigabitEthernet1/0/1]port link-mode route
The configuration of the interface will be restored to the default. Continue? [Y/N]:y
%May 22 14:47:55:117 2024 S3 IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet1/0/1 changed to down.
%May 22 14:47:55:117 2024 S3 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0/1 changed to down.
[S3-GigabitEthernet1/0/1]%May 22 14:47:57:319 2024 S3 IFNET/3/PHY_UPDOWN: Physical state on the interface GigabitEthernet1/0/1 changed to up.
%May 22 14:47:57:319 2024 S3 IFNET/5/LINK_UPDOWN: Line protocol state on the interface GigabitEthernet1/0/1 changed to up.
[S3-GigabitEthernet1/0/1]ip address 10.20.13.1 30
[S3-GigabitEthernet1/0/1]quit
配置CE1
<H3C>sys
[H3C]sysname CE1
[CE1]interface g0/1
[CE1-GigabitEthernet0/1]ip address 10.20.13.2 30
[CE1-GigabitEthernet0/1]quit
[CE1]interface g5/0
[CE1-GigabitEthernet5/0]ip address 100.20.11.1 24
[CE1-GigabitEthernet5/0]quit
配置PE3
<H3C>sys
[H3C]sysname PE3
[PE3]interface g5/0
[PE3-GigabitEthernet5/0]ip address 100.20.11.2 24
[PE3-GigabitEthernet5/0]quit
[PE3]interface g0/2
[PE3-GigabitEthernet0/2]ip address 100.10.13.1 30
[PE3-GigabitEthernet0/2]quit
[PE3]interface g0/0
[PE3-GigabitEthernet0/0]ip address 100.10.12.1 30
[PE3-GigabitEthernet0/0]quit
配置RR2
<H3C>sys
[H3C]sysname RR2
[RR2]interface g0/2
[RR2-GigabitEthernet0/2]ip address 100.10.13.2 30
[RR2-GigabitEthernet0/2]quit
[RR2]interface g0/0
[RR2-GigabitEthernet0/0]ip address 100.10.34.1 30
[RR2-GigabitEthernet0/0]quit
配置P2
<H3C>sys
[H3C]sysname P2
[P2]interface g0/0
[P2-GigabitEthernet0/0]ip address 100.10.34.2 30
[P2-GigabitEthernet0/0]quit
[P2]interface g0/2
[P2-GigabitEthernet0/2]ip address 100.10.24.2 30
[P2-GigabitEthernet0/2]quit
配置P4
<H3C>sys
[H3C]sysname PE4
[PE4]interface g0/0
[PE4-GigabitEthernet0/0]ip address 100.10.12.2 3
[PE4-GigabitEthernet0/0]quit
[PE4]interface g0/2
[PE4-GigabitEthernet0/2]ip address 100.10.24.1 30
[PE4-GigabitEthernet0/2]quit
[PE4]interface s1/0
[PE4-Serial1/0]ip address 100.30.25.1 30
[PE4-Serial1/0]quit
配置CE5
<CE5>sys
[CE5]interface s1/0
[CE5-Serial1/0]ip address 100.30.25.2 30
[CE5-Serial1/0]quit
2、测试CE1ping相邻端口和不相邻端口
//CE1 ping PE3左端口
<CE1>ping 100.20.11.2
Ping 100.20.11.2 (100.20.11.2): 56 data bytes, press CTRL+C to break
56 bytes from 100.20.11.2: icmp_seq=0 ttl=255 time=1.000 ms
56 bytes from 100.20.11.2: icmp_seq=1 ttl=255 time=2.000 ms
56 bytes from 100.20.11.2: icmp_seq=2 ttl=255 time=1.000 ms
56 bytes from 100.20.11.2: icmp_seq=3 ttl=255 time=1.000 ms
56 bytes from 100.20.11.2: icmp_seq=4 ttl=255 time=2.000 ms
//CE1 ping CE5左端口
<CE1>ping 100.30.25.2
Ping 100.30.25.2 (100.30.25.2): 56 data bytes, press CTRL+C to break
Request time out
Request time out
Request time out
3、配置静态路由
相邻直连不需要配置
<CE1>sys
[CE1]ip route-static 100.30.25.0 30 100.20.11.2
<PE3>sys
[PE3]ip route-static 100.30.25.0 30 100.10.12.2
<CE5>sys
[CE5]ip route-static 100.20.11.0 24 100.30.25.1
<PE4>sys
[PE4]ip route-static 100.20.11.0 24 100.10.12.1
4、测试路由ping通
//CE1 ping CE5
[CE1]ping 100.30.25.2
Ping 100.30.25.2 (100.30.25.2): 56 data bytes, press CTRL+C to break
56 bytes from 100.30.25.2: icmp_seq=0 ttl=253 time=3.000 ms
56 bytes from 100.30.25.2: icmp_seq=1 ttl=253 time=3.000 ms
56 bytes from 100.30.25.2: icmp_seq=2 ttl=253 time=5.000 ms
56 bytes from 100.30.25.2: icmp_seq=3 ttl=253 time=4.000 ms
56 bytes from 100.30.25.2: icmp_seq=4 ttl=253 time=4.000 ms
//CE5 ping CE1
[CE5]ping 100.20.11.1
Ping 100.20.11.1 (100.20.11.1): 56 data bytes, press CTRL+C to break
56 bytes from 100.20.11.1: icmp_seq=0 ttl=253 time=3.000 ms
56 bytes from 100.20.11.1: icmp_seq=1 ttl=253 time=5.000 ms
56 bytes from 100.20.11.1: icmp_seq=2 ttl=253 time=3.000 ms
56 bytes from 100.20.11.1: icmp_seq=3 ttl=253 time=5.000 ms
56 bytes from 100.20.11.1: icmp_seq=4 ttl=253 time=5.000 ms
至此实现路由间不同网段的端口ping通
发现PE4 100.10.12.2 3有误,需修改端口ip为100.10.12.2 30
<PE4>sys
System View: return to User View with Ctrl+Z.
[PE4]interface g0/0
[PE4-GigabitEthernet0/0]ip address 100.10.12.2 30
[PE4-GigabitEthernet0/0]quit
同理用静态路由实现全部设备Ping通
S3
//设置这条是为PCping通CE1 g0/1端口
ip route-static 10.20.13.0 30 10.20.13.2
ip route-static 100.20.11.0 24 10.20.13.2
ip route-static 100.10.12.0 30 10.20.13.2
ip route-static 100.10.24.0 30 10.20.13.2
ip route-static 100.10.34.0 30 10.20.13.2
ip route-static 100.10.13.0 30 10.20.13.2
ip route-static 100.30.25.0 30 10.20.13.2
ip route-static 10.30.9.0 24 10.20.13.2
ip route-static 10.30.10.0 24 10.20.13.2
CE1
ip route-static 10.30.2.0 24 10.20.13.1
ip route-static 10.30.3.0 24 10.20.13.1
ip route-static 100.10.13.0 30 100.20.11.2
ip route-static 100.10.12.0 30 100.20.11.2
ip route-static 100.10.24.0 30 100.20.11.2
ip route-static 100.10.34.0 30 100.20.11.2
ip route-static 100.30.25.0 30 100.20.11.2
ip route-static 10.30.9.0 24 100.20.11.2
ip route-static 10.30.10.0 24 100.20.11.2
PE3
ip route-static 10.30.2.0 24 100.20.11.1
ip route-static 10.30.3.0 24 100.20.11.1
ip route-static 10.20.13.0 30 100.20.11.1
ip route-static 100.10.34.0 30 100.10.13.2
ip route-static 100.10.24.0 30 100.10.12.2
ip route-static 100.30.25.0 30 100.10.12.2
ip route-static 10.30.9.0 24 100.10.12.2
ip route-static 10.30.10.0 24 100.10.12.2
RR2
ip route-static 10.30.2.0 24 100.10.13.1
ip route-static 10.30.3.0 24 100.10.13.1
ip route-static 10.20.13.0 30 100.10.13.1
ip route-static 100.20.11.0 24 100.10.13.1
ip route-static 100.10.12.0 30 100.10.13.1
ip route-static 100.10.24.0 30 100.10.34.2
ip route-static 100.30.25.0 30 100.10.34.2
ip route-static 10.30.9.0 24 100.10.34.2
ip route-static 10.30.10.6 24 100.10.34.2
P2
ip route-static 10.30.2.0 24 100.10.34.1
ip route-static 10.30.3.0 24 100.10.34.1
ip route-static 10.20.13.0 30 100.10.34.1
ip route-static 100.20.11.0 24 100.10.34.1
ip route-static 100.10.13.0 30 100.10.34.1
ip route-static 100.10.12.0 30 100.10.24.1
ip route-static 100.30.25.0 30 100.10.24.1
ip route-static 10.30.9.0 24 100.10.24.1
ip route-static 10.30.10.0 24 100.10.24.1
PE4
ip route-static 10.30.2.0 24 100.10.12.1
ip route-static 10.30.3.0 24 100.10.12.1
ip route-static 10.20.13.0 30 100.10.12.1
ip route-static 100.20.11.0 24 100.10.12.1
ip route-static 100.10.13.0 30 100.10.12.1
ip route-static 100.10.34.0 30 100.10.24.2
ip route-static 10.30.9.0 24 100.30.25.2
ip route-static 10.30.10.0 24 100.30.25.2
CE5
ip route-static 0.0.0.0 0.0.0.0 s1/0