目录
按照规划的网段配置PC 地址
在AR1 上配置IP地址
[Huawei-GigabitEthernet0/0/2]ip address 10.0.2.1 24
[Huawei-GigabitEthernet0/0/1]ip address 192.168.2.1 24
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 24
在AR2上配置IP地址
[AR2-GigabitEthernet0/0/0]ip address 192.168.1.2 24
[AR2-GigabitEthernet0/0/2]ip address 192.168.2.2 24
[AR2-GigabitEthernet0/0/1]ip address 192.168.3.1 24
[AR2-GigabitEthernet4/0/0]ip address 192.168.4.1 24
[AR2-GigabitEthernet3/0/0]ip address 10.0.1.1 24
AR3 配置IP地址
[Huawei-GigabitEthernet0/0/0]ip address 192.168.3.2 24
[Huawei-GigabitEthernet0/0/1]ip address 192.168.4.2 24
[Huawei-GigabitEthernet0/0/2]ip address 10.0.3.1 24
AR1 上配置静态路由如下
ip route-static 10.0.1.0 24 192.168.1.2
ip route-static 10.0.1.0 24 192.168.2.2
AR2上配置静态路由如下
ip route-static 10.0.2.0 255.255.255.0 192.168.1.1
ip route-static 10.0.2.0 255.255.255.0 192.168.2.1
PC1 上PING PC3
PC>ping 10.0.1.2
Ping 10.0.1.2: 32 data bytes, Press Ctrl_C to break
From 10.0.1.2: bytes=32 seq=1 ttl=126 time=15 ms
From 10.0.1.2: bytes=32 seq=2 ttl=126 time=16 ms
From 10.0.1.2: bytes=32 seq=3 ttl=126 time=31 ms
From 10.0.1.2: bytes=32 seq=4 ttl=126 time=16 ms
From 10.0.1.2: bytes=32 seq=5 ttl=126 time=15 ms
--- 10.0.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/18/31 ms
AR2上配置命令如下
ip route-static 10.0.3.0 255.255.255.0 192.168.3.2
ip route-static 10.0.3.0 255.255.255.0 192.168.4.2
AR3上配置命令如下
ip route-static 10.0.2.0 255.255.255.0 192.168.3.1
ip route-static 10.0.2.0 255.255.255.0 192.168.4.1
PC1 上PING PC2
PC>ping 10.0.3.2
Ping 10.0.3.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 10.0.3.2: bytes=32 seq=2 ttl=125 time=31 ms
From 10.0.3.2: bytes=32 seq=3 ttl=125 time=16 ms
From 10.0.3.2: bytes=32 seq=4 ttl=125 time=31 ms
From 10.0.3.2: bytes=32 seq=5 ttl=125 time=16 ms
--- 10.0.3.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/23/31 ms
AR3上缺少一条去往PC3的路由条目,故PC2 和PC3不能互通
PC>ping 10.0.3.2
Ping 10.0.3.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
Request timeout!
Request timeout!
Request timeout!
--- 10.0.3.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
AR1和AR2做负载均衡
[Huawei]dis ip routing-table
Route Flags: R - relay, D - download to fib
Routing Tables: Public
Destinations : 15 Routes : 17
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.0/24 Static 60 0 RD 192.168.1.2 GigabitEthernet 0/0/0
Static 60 0 RD 192.168.2.2 GigabitEthernet 0/0/1
10.0.2.0/24 Direct 0 0 D 10.0.2.1 GigabitEthernet 0/0/2
10.0.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2
10.0.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2
10.0.3.0/24 Static 60 0 RD 192.168.1.2 GigabitEthernet 0/0/0
Static 60 0 RD 192.168.2.2 GigabitEthernet 0/0/1
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
192.168.1.0/24 Direct 0 0 D 192.168.1.1 GigabitEthernet0/0/0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
192.168.2.0/24 Direct 0 0 D 192.168.2.1 GigabitEthernet0/0/1
192.168.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
配置AR2 和AR3 路由备份如下
[AR2]ip route-static 10.0.3.0 24 192.168.3.2 preference 100
在AR2上查看静态路由表
[AR2]dis ip routing-table protocol static
Route Flags: R - relay, D - download to fib
Public routing table : Static
Destinations : 2 Routes : 4 Configured Routes : 4
Static routing table status : <Active>
Destinations : 2 Routes : 3
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.2.0/24 Static 60 0 RD 192.168.1.1 GigabitEthernet
0/0/0
Static 60 0 RD 192.168.2.1 GigabitEthernet
0/0/2
10.0.3.0/24 Static 60 0 RD 192.168.4.2 GigabitEthernet
4/0/0
Static routing table status : <Inactive>
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.3.0/24 Static 100 0 R 192.168.3.2 GigabitEthernet
0/0/1