2、新H3C杯——静态路由实验(练习)
程序员文章站
2024-03-20 22:36:16
...
0x01、静态路由实验
0x02、配置
1、PC1的配置:
2、PC2的配置:
3、PC3的配置:
4、PC4的配置:
5、SW1的配置:
①、配置设备名称:
sys
sys SW1
②、划分Vlan,配置Trunk:
vlan 10
port g1/0/1
vlan 20
port g1/0/2
int g1/0/3
port li tr
po tr per vlan 10 20
6、验证SW1的配置
①、dis vlan br
10 VLAN 0010 GE1/0/1 GE1/0/3
20 VLAN 0020 GE1/0/2 GE1/0/3
②、dis port tr
Interface PVID VLAN Passing
GE1/0/3 1 1, 10, 20
7、SW2的配置:
①、配置设备名称:
sys
sys SW2
②、划分Vlan,配置Trunk:
vlan 10
vlan 20
int g1/0/1
port li tr
po tr per vlan 10 20
③、配置ip地址
int vlan 10
ip add 192.168.1.254 24
int vlan 20
ip add 192.168.2.254 24
int g1/0/2
port link-mode route
ip add 10.0.0.2 30
//配置ip时候上小下大,左小右大
④、配置静态路由:
ip ro 192.168.3.0 255.255.255.0 10.0.0.1
ip ro 192.168.4.0 255.255.255.0 10.0.0.1
8、验证SW2的配置:
①、dis vlan br
10 VLAN 0010 GE1/0/1
20 VLAN 0020 GE1/0/1
②、dis po tr
Interface PVID VLAN Passing
GE1/0/1 1 1, 10, 20
③、dis ip int br
*down: administratively down
(s): spoofing (l): loopback
Interface Physical Protocol IP Address Description
GE1/0/2 up up 10.0.0.2 --
MGE0/0/0 down down -- --
Vlan10 up up 192.168.1.254 --
Vlan20 up up 192.168.2.254 --
④、dis ip ro pro static
Summary count : 2
Static Routing table status : <Active>
Summary count : 2
Destination/Mask Proto Pre Cost NextHop Interface
192.168.3.0/24 Static 60 0 10.0.0.1 GE1/0/2
192.168.4.0/24 Static 60 0 10.0.0.1 GE1/0/2
Static Routing table status : <Inactive>
Summary count : 0
9、R2的配置:
①、配置设备名称
sys
sys R2
②、配置IP地址
int g0/0
ip add 10.0.0.1 30
int g0/1
ip add 10.0.0.5 30
③、配置静态路由
ip ro 192.168.1.0 255.255.255.0 10.0.0.2
ip ro 192.168.2.0 255.255.255.0 10.0.0.2
ip ro 192.168.3.0 255.255.255.0 10.0.0.6
ip ro 192.168.4.0 255.255.255.0 10.0.0.6
10、验证R2的配置
①、dis ip int br
*down: administratively down
(s): spoofing (l): loopback
Interface Physical Protocol IP Address Description
GE0/0 up up 10.0.0.1 --
GE0/1 up up 10.0.0.5 --
GE0/2 down down -- --
GE5/0 down down -- --
GE5/1 down down -- --
GE6/0 down down -- --
GE6/1 down down -- --
Ser1/0 down down -- --
Ser2/0 down down -- --
Ser3/0 down down -- --
Ser4/0 down down -- --
②、dis ip ro pro static
Summary count : 4
Static Routing table status : <Active>
Summary count : 4
Destination/Mask Proto Pre Cost NextHop Interface
192.168.1.0/24 Static 60 0 10.0.0.2 GE0/0
192.168.2.0/24 Static 60 0 10.0.0.2 GE0/0
192.168.3.0/24 Static 60 0 10.0.0.6 GE0/1
192.168.4.0/24 Static 60 0 10.0.0.6 GE0/1
Static Routing table status : <Inactive>
Summary count : 0
11、R3的配置:
①、配置设备名称
sys
sys R3
②、配置IP地址
int g0/0
ip add 10.0.0.6 30
int g0/1.1
vlan-type dot1q vid 30
ip add 192.168.3.254 24
int g0/1.2
vlan-type dot1q vid 40
ip add 192.168.4.254 24
③、配置静态路由:
ip ro 192.168.1.0 24 10.0.0.5
ip ro 192.168.2.0 24 10.0.0.5
12、验证R3的配置:
①、dis ip int br
*down: administratively down
(s): spoofing (l): loopback
Interface Physical Protocol IP Address Description
GE0/0 up up 10.0.0.6 --
GE0/1 up up -- --
GE0/1.1 up up 192.168.3.254 --
GE0/1.2 up up 192.168.4.254 --
GE0/2 down down -- --
GE5/0 down down -- --
GE5/1 down down -- --
GE6/0 down down -- --
GE6/1 down down -- --
Ser1/0 down down -- --
Ser2/0 down down -- --
Ser3/0 down down -- --
Ser4/0 down down -- --
②、dis ip ro pro static
Summary count : 2
Static Routing table status : <Active>
Summary count : 2
Destination/Mask Proto Pre Cost NextHop Interface
192.168.1.0/24 Static 60 0 10.0.0.5 GE0/0
192.168.2.0/24 Static 60 0 10.0.0.5 GE0/0
Static Routing table status : <Inactive>
Summary count : 0
13、SW3的配置
①、配置设备名称
sys
sys SW3
②、配置Vlan,Trunk
vlan 30
port g1/0/2
vlan 40
port g1/0/3
int g1/0/1
port li tr
port tr per vlan 30 40
14、验证SW3的配置
①、dis vlan br
30 VLAN 0030 GE1/0/1 GE1/0/2
40 VLAN 0040 GE1/0/1 GE1/0/3
②、dis port trunk
Interface PVID VLAN Passing
GE1/0/1 1 1, 30, 40
15、利用PC1,测试业务网段的互通
①、ping 192.168.2.1
Ping 192.168.2.1 (192.168.2.1): 56 data bytes, press CTRL_C to break
56 bytes from 192.168.2.1: icmp_seq=0 ttl=254 time=2.000 ms
56 bytes from 192.168.2.1: icmp_seq=1 ttl=254 time=5.000 ms
56 bytes from 192.168.2.1: icmp_seq=2 ttl=254 time=1.000 ms
56 bytes from 192.168.2.1: icmp_seq=3 ttl=254 time=2.000 ms
56 bytes from 192.168.2.1: icmp_seq=4 ttl=254 time=4.000 ms
--- Ping statistics for 192.168.2.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.000/2.800/5.000/1.470 ms
[H3C]%Feb 17 15:21:44:546 2020 H3C PING/6/PING_STATISTICS: Ping statistics for 192.168.2.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.000/2.800/5.000/1.470 ms.
②、ping 192.168.3.1
Ping 192.168.3.1 (192.168.3.1): 56 data bytes, press CTRL_C to break
56 bytes from 192.168.3.1: icmp_seq=0 ttl=252 time=3.000 ms
56 bytes from 192.168.3.1: icmp_seq=1 ttl=252 time=4.000 ms
56 bytes from 192.168.3.1: icmp_seq=2 ttl=252 time=3.000 ms
56 bytes from 192.168.3.1: icmp_seq=3 ttl=252 time=9.000 ms
56 bytes from 192.168.3.1: icmp_seq=4 ttl=252 time=2.000 ms
--- Ping statistics for 192.168.3.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 2.000/4.200/9.000/2.482 ms
[H3C]%Feb 17 15:22:54:520 2020 H3C PING/6/PING_STATISTICS: Ping statistics for 192.168.3.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 2.000/4.200/9.000/2.482 ms.
③、ping 192.168.4.1
Ping 192.168.4.1 (192.168.4.1): 56 data bytes, press CTRL_C to break
56 bytes from 192.168.4.1: icmp_seq=0 ttl=252 time=2.000 ms
56 bytes from 192.168.4.1: icmp_seq=1 ttl=252 time=3.000 ms
56 bytes from 192.168.4.1: icmp_seq=2 ttl=252 time=3.000 ms
56 bytes from 192.168.4.1: icmp_seq=3 ttl=252 time=3.000 ms
56 bytes from 192.168.4.1: icmp_seq=4 ttl=252 time=5.000 ms
--- Ping statistics for 192.168.4.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 2.000/3.200/5.000/0.980 ms
[H3C]%Feb 17 15:23:05:307 2020 H3C PING/6/PING_STATISTICS: Ping statistics for 192.168.4.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 2.000/3.200/5.000/0.980 ms.
④、ping 10.0.0.5
Ping 10.0.0.5 (10.0.0.5): 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- Ping statistics for 10.0.0.5 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
[H3C]%Feb 17 15:23:27:028 2020 H3C PING/6/PING_STATISTICS: Ping statistics for 10.0.0.5: 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.
⑤、ping 10.0.0.6
Ping 10.0.0.6 (10.0.0.6): 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- Ping statistics for 10.0.0.6 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
[H3C]%Feb 17 15:23:46:239 2020 H3C PING/6/PING_STATISTICS: Ping statistics for 10.0.0.6: 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.
0x03、配置总结
注意:
IP连通的必备条件:
1.沿途的每一台路由器(或三层交换机)都具有到达目的网段的路由信息
2.必须具有往返的双向路由信息
1、单臂路由配置:(直接入二层接入交换机直连)
int g0/1.1
vlan-type dot1q vid 30
ip add 192.168.3.254 24
int g0/1.2
vlan-type dot1q vid 40
ip add 192.168.4.254 24
配置在哪:与接入层交换机直接相连的下行口处
2、单臂路由配置方法:
①.在二层接入交换机上创建VLAN,下行口加入到VLAN,上行口配置trunk并且放行相应
的VLAN
②.在路由器的下行口上创建子接口,并且绑定相应的VLAN,配置网关IP
3、三层交换机配置:
第一种:(把二层口的桥模式口修改为为路由模式口)
int g1/0/1
port link-mode route
ip add 192.168.1.254 24
int g1/0/2
port link-mode route
ip add 192.168.2.254 24
第二种:(在接入交换机上配置)
vlan 10
port g1/0/1
vlan 20
port g1/0/2
int vlan 10
ip add 192.168.1.254 24
int vlan 20
ip add 192.168.2.254 24
(或者,常见的:在汇聚层交换机上配置)
int g1/0/1
port link-type trunk
port trunk permit vlan 10 20
vlan 10
int vlan 10
ip add 192.168.1.254 24
vlan 20
int vlan 20
ip add 192.168.2.254 24
推荐阅读