ip配置一览表
设备 | 端口 | IP地址 |
VPC11 | eth0 | 192.168.1.10 |
---|---|---|
AR1000V | G0/0/0 | 192.168.1.20 |
AR1000V | G0/0/1 | 192.168.2.10 |
AR1000V1 | G0/0/0 | 192.168.2.20 |
AR1000V1 | G0/0/1 | 192.168.3.10 |
AR1000V2 | G0/0/0 | 192.168.3.20 |
AR1000V2 | G0/0/1 | 192.168.4.20 |
VPC4 | eth0 | 192.168.4.10 |
1、华为路由器配置静态IP
举例:给路由器AR1000V配置静态ip
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.1.20 24
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.2.10 24
2、给路由器AR1000V配置默认路由,给AR1000V1、AR1000V2这两个路由器配置静态路由
AR1000v
undo ip route-static 192.168.4.0 255.255.255.0 192.168.2.20 #删除原来的静态路由配置
ip route-static 0.0.0.0 0.0.0.0 192.168.2.20 #添加默认路由
AR1000v1
ip route-static 192.168.1.0 24 192.168.2.10 #静态路由:目的IP网段 子网掩码 下一跳IP
ip route-static 192.168.4.0 24 192.168.3.20
AR1000v2
ip route-static 192.168.1.0 24 192.168.3.10
ip route-static 192.168.2.0 24 192.168.3.10 #注意:下一跳地址(192.168.3.10)
必须是上一个路由器(AR1000v1)对应端口地址,不能是本路由器对应端口地址
3、查看AR1000v路由表
[Huawei]dis ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 192.168.2.20 GigabitEthernet0/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.20 GigabitEthernet0/0/0
192.168.1.20/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.10 GigabitEthernet0/0/1
192.168.2.10/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
4、测试pc之间的连通性
5、总结
如果路由器会因为路由表中没有数据包目的地址的匹配项就丢弃数据包,那么大量去往路由器未知网络的数据包都会在转发过程中遭到丢弃,这会对网络用户的正常访问操作造成严重的影响。为了避免这种情况,管理员常常会配置一条掩码长度为0的全0位静态路由。这样一来,依据IP地址/掩码的最长匹配原则,一条全0路由可以匹配以任何IP地址作为目的地址的数据包,这就可以保证任何数据包都不会因为找不到匹配的路由条目而被丢弃;