组网需求
某企业网内用户因业务需要划分了不同网段,不同网段用户想能够实现互访。由于企业网规模不大,且要求网络简单,安全,可靠以及转发效率高,所以采用配置静态路由实现组网中任意两台主机之间都能互通。在配置IPv4静态路由之前。
需完成以下任务:配置接口的链路层协议参数和IP地址,使相邻节点网络层可达。
配置静态路由组网图
操作步骤
步骤1 RouterA的配置
system-view
[Huawei] system RouterA
[RouterA] interface GigabitEthernet0/0/2
[RouterA-GigabitEthernet0/0/2] ip address 10.1.1.1 255.255.255.0
[RouterA-GigabitEthernet0/0/2] interface GigabitEthernet0/0/0
[RouterA-GigabitEthernet0/0/0] ip address 10.1.4.1 255.255.255.252
[RouterA-GigabitEthernet0/0/0] quit
[RouterA] ip route-static 10.1.2.0 255.255.255.0 10.1.4.2
[RouterA] ip route-static 10.1.3.0 255.255.255.0 10.1.4.2
[RouterA] return
步骤2 RouterB的配置
system-view
[Huawei] system RouterB
[RouterB] interface GigabitEthernet0/0/2
[RouterB-GigabitEthernet0/0/2] ip address 10.1.2.1 255.255.255.0
[RouterB-GigabitEthernet0/0/2] interface GigabitEthernet0/0/0
[RouterB-GigabitEthernet0/0/0] ip address 10.1.4.2 255.255.255.252
[RouterB-GigabitEthernet0/0/0] interface GigabitEthernet0/0/1
[RouterB-GigabitEthernet0/0/1] ip address 10.1.4.5 255.255.255.252
[RouterB-GigabitEthernet0/0/1] quit
[RouterB] ip route-static 10.1.1.0 255.255.255.0 10.1.4.1
[RouterB] ip route-static 10.1.3.0 255.255.255.0 10.1.4.6
[RouterB] return
步骤3 RouterC的配置
system-view
[Huawei] system RouterC
[RouterC] interface GigabitEthernet0/0/2
[RouterC-GigabitEthernet0/0/2] ip address 10.1.3.1 255.255.255.0
[RouterC-GigabitEthernet0/0/2] interface GigabitEthernet0/0/0
[RouterC-GigabitEthernet0/0/0] ip address 10.1.4.6 255.255.255.252
[RouterC-GigabitEthernet0/0/2] quit
[RouterC] ip route-static 10.1.1.0 255.255.255.0 10.1.4.5
[RouterC] ip route-static 10.1.2.0 255.255.255.0 10.1.4.5
[RouterC] return
步骤4 配置主机
配置VLAN10内主机的缺省网关为10.1.1.1,VLAN20内主机的缺省网关为10.1.3.1,VLAN30内主机的缺省网关为10.1.2.1。
下面以PC1为例:
步骤5 验证配置结果
1、使用display ip routing-table命令查看路由器的IP路由表。
[Huawei]display IP routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet0/0/2
10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2
10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2
10.1.2.0/24 Static 60 0 RD 10.1.4.2 GigabitEthernet0/0/0
10.1.3.0/24 Static 60 0 RD 10.1.4.2 GigabitEthernet0/0/0
10.1.4.0/30 Direct 0 0 D 10.1.4.1 GigabitEthernet0/0/0
10.1.4.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.1.4.3/32 Direct 0 0 D 127.0.0.1
GigabitEthernet0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
2、在PC1终端使用Ping PC2验证连通性(3台电脑之间相互ping测试连通性)。
PC>ping 10.1.3.2
Ping 10.1.3.2: 32 data bytes, Press Ctrl_C to break
From 10.1.3.2: bytes=32 seq=1 ttl=125 time=16 ms
From 10.1.3.2: bytes=32 seq=2 ttl=125 time=31 ms
From 10.1.3.2: bytes=32 seq=3 ttl=125 time=15 ms
From 10.1.3.2: bytes=32 seq=4 ttl=125 time=31 ms
From 10.1.3.2: bytes=32 seq=5 ttl=125 time=32 ms
--- 10.1.3.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/25/32 ms
配置注意事项
1、正确配置各路由器各接口的IPv4地址,使网络互通。
2、保证两个路由器互连接口地址配置在同一网段,并且可以正常互通。
3、在各主机上配置IPv4缺省网关。