网络拓扑图
将三层交换机当路由器使用
交换机配置
<H3C>dis stp brief
MST ID Port Role STP State Protection
0 GigabitEthernet1/0/1 DESI LEARNING NONE
0 GigabitEthernet1/0/2 DESI LEARNING NONE
当前启用了两个接口
[H3C]int GigabitEthernet1/0/1
[H3C-GigabitEthernet1/0/1]port link-mode route
[H3C-GigabitEthernet1/0/1]ip add 1.1.1.1 24
[H3C-GigabitEthernet1/0/1]ping 1.1.1.2
Ping 1.1.1.2 (1.1.1.2): 56 data bytes, press CTRL_C to break
56 bytes from 1.1.1.2: icmp_seq=0 ttl=64 time=1.335 ms
56 bytes from 1.1.1.2: icmp_seq=1 ttl=64 time=0.815 ms
56 bytes from 1.1.1.2: icmp_seq=2 ttl=64 time=0.942 ms
56 bytes from 1.1.1.2: icmp_seq=3 ttl=64 time=0.717 ms
56 bytes from 1.1.1.2: icmp_seq=4 ttl=64 time=0.820 ms
将端口设置为路由模式,配置IP地址,测试直连的计算机,OK。
第二个端口同样配置
[H3C]int GigabitEthernet1/0/2
[H3C-GigabitEthernet1/0/2]port link-mode route
[H3C-GigabitEthernet1/0/2]ip address 2.2.2.1 24
[H3C-GigabitEthernet1/0/2]ping 2.2.2.2
Ping 2.2.2.2 (2.2.2.2): 56 data bytes, press CTRL_C to break
56 bytes from 2.2.2.2: icmp_seq=0 ttl=64 time=1.190 ms
56 bytes from 2.2.2.2: icmp_seq=1 ttl=64 time=1.010 ms
56 bytes from 2.2.2.2: icmp_seq=2 ttl=64 time=1.036 ms
56 bytes from 2.2.2.2: icmp_seq=3 ttl=64 time=1.091 ms
56 bytes from 2.2.2.2: icmp_seq=4 ttl=64 time=1.058 ms
PC之间测试
PC1 : 1.1.1.2 255.255.255.0 gateway 1.1.1.1
VPCS_2> ping 2.2.2.2
84 bytes from 2.2.2.2 icmp_seq=1 ttl=63 time=1.220 ms
84 bytes from 2.2.2.2 icmp_seq=2 ttl=63 time=1.115 ms
84 bytes from 2.2.2.2 icmp_seq=3 ttl=63 time=1.402 ms
84 bytes from 2.2.2.2 icmp_seq=4 ttl=63 time=1.284 ms
84 bytes from 2.2.2.2 icmp_seq=5 ttl=63 time=1.564 ms
三层交换机上无需配置路由协议,自动完成路由。测试正常。