R1:

<Huawei>system-view

[Huawei]sysname R1
[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ip add 172.16.1.1 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 10.10.1.1 24

[R1-GigabitEthernet0/0/1]quit

[R1]vlan 10      //e口是二层口,无法配置IP,需要用VLAN来配置IP
[R1-vlan10]int vlanif 10
[R1-Vlanif10]ip add 192.168.1.1 24
[R1-Vlanif10]quit
[R1]int e0/0/0
[R1-Ethernet0/0/0]port link-type access

[R1-Ethernet0/0/0]port default vlan 10

[R1-Ethernet0/0/0]quit

[R1]ip route-static 192.168.3.0 24 172.16.1.2 preference 60   //静态路由默认60优先级,数字越大,优先级越小
[R1]ip route-static 192.168.3.0 24 10.10.1.2 preference 70

[R1]ip route-static 192.168.2.0 24 10.10.1.2 preference 60
[R1]ip route-static 192.168.2.0 24 172.16.1.2 preference 70

R2:

<Huawei>sys
[Huawei]sys R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 1.1.1.1 24
[R2-GigabitEthernet0/0/1]vlan 10
[R2-vlan10]int vlan 10
[R2-Vlanif10]ip add 192.168.3.1 24
[R2-Vlanif10]int e0/0/0
[R2-Ethernet0/0/0]port link-t acc
[R2-Ethernet0/0/0]port def vlan 10

[R2-Ethernet0/0/0]quit

[R2]ip route-static 192.168.1.0 24 172.16.1.1 preference 60
[R2]ip route-static 192.168.1.0 24 1.1.1.2 preference 70
[R2]ip route-static 192.168.2.0 24 1.1.1.2 preference 60
[R2]ip route-static 192.168.2.0 24 172.16.1.1 preference 70

R3:

<Huawei>sys
[Huawei]sys R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 10.10.1.2 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 1.1.1.2 24
[R3-GigabitEthernet0/0/1]vlan 10
[R3-vlan10]int vlan 10
[R3-Vlanif10]ip add 192.168.2.1 24
[R3-Vlanif10]int e0/0/0
[R3-Ethernet0/0/0]port link-t acc
[R3-Ethernet0/0/0]port def vlan 10 

[R3-Ethernet0/0/0]quit

[R3]ip route-static 192.168.1.0 24 10.10.1.1 preference 60
[R3]ip route-static 192.168.1.0 24 1.1.1.1 preference 70
[R3]ip route-static 192.168.3.0 24 1.1.1.1 preference 60
[R3]ip route-static 192.168.3.0 24 10.10.1.1 preference 70

修改R1路径优先级

[R1]ip route-static 192.168.2.0 24 10.10.1.2 preference 80

 

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部