静态的实验

R1

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
[r1-GigabitEthernet0/0/0]int g0/0/1           
[r1-GigabitEthernet0/0/1]ip add 192.168.1.22 30

R2

[r2]INT G0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.1 30
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.1.5 30

R3

[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.1.18 30
[r3-GigabitEthernet0/0/1]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.21 30

R4

[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.6 30
[r4-GigabitEthernet0/0/0]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.1.9 30
[r4-GigabitEthernet0/0/2]int g0/0/3
[r4-GigabitEthernet0/0/3]ip add 192.168.1.14 30
[r4-GigabitEthernet0/0/3]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.17 30

R5

[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.10 30
[r5-GigabitEthernet0/0/0]int g0/0/2
[r5-GigabitEthernet0/0/2]ip add 192.168.1.13 30
[r5-GigabitEthernet0/0/2]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 12.1.1.1 24

R6

[r6]int g0/0/0

[r6-GigabitEthernet0/0/0]ip add 12.0.0.2 24

[r6-GigabitEthernet0/0/0]int loopback0

[r6-LoopBack0]ip add 1.1.1.1 24

R3下的两台PC通过DHCP自动获取IP地址

先创建VLAN,然后划分到 2 台PC上

[Huawei]vlan batch 2 3
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 2
[Huawei-GigabitEthernet0/0/2]q
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type access
[Huawei-GigabitEthernet0/0/3]port default vlan 3

 在R3上

[r3]int g0/0/2.1
[r3-GigabitEthernet0/0/2.1]ip add 192.168.1.161 28
[r3-GigabitEthernet0/0/2.1]dot1q termination vid 2
[r3-GigabitEthernet0/0/2.1]arp broadcast enable
[r3-GigabitEthernet0/0/2.1]q
[r3]int g0/0/2.2
[r3-GigabitEthernet0/0/2.2]ip add 192.168.1.177 28
[r3-GigabitEthernet0/0/2.2]dot1q termination vid 3
[r3-GigabitEthernet0/0/2.2]arp broadcast enable

[r3]ip pool class_A
Info:It's successful to create an IP address pool.
[r3-ip-pool-class_A]network 192.168.1.160 mask 28
[r3-ip-pool-class_A]gateway-list 192.168.1.161
[r3-ip-pool-class_A]dns-list 8.8.8.8
[r3-ip-pool-class_A]q
[r3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r3]int g0/0/2.1
[r3-GigabitEthernet0/0/2.1]dhcp select global
[r3-GigabitEthernet0/0/2.1]q
[r3]ip pool class_B
Info:It's successful to create an IP address pool.
[r3-ip-pool-class_B]dns-list 8.8.8.8network 192.168.1.76
[r3-ip-pool-class_B]dns-list 8.8.8.8gateway-list 192.168.1.177
[r3-ip-pool-class_B]dns-list 8.8.8.8
[r3]int g0/0/2.2
[r3-GigabitEthernet0/0/2.2]dhcp select global

[Huawei]int g0/0/1

[Huawei-GigabitEthernet0/0/1]port link-type trunk

[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all

pc端结果显示:

静态路由的配置:

 R1

[r1]ip route-static 192.168.1.64 27 192.168.1.2
[r1]ip route-static 192.168.1.96 27 192.168.1.2
[r1]ip route-static 192.168.1.128 27 192.168.1.2
[r1]ip route-static 192.168.1.128 27 192.168.1.21
[r1]ip route-static 192.168.1.160 27 192.168.1.21
[r1]ip route-static 192.168.1.4 30 192.168.1.2
[r1]ip route-static 192.168.1.8 30 192.168.1.2
[r1]ip route-static 192.168.1.12 30 192.168.1.21
[r1]ip route-static 192.168.1.16 30 192.168.1.21

R2

[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]ip route-static 192.168.1.96 27 192.168.1.6  
[r2]ip route-static 192.168.1.128 27 192.168.1.6
[r2]ip route-static 192.168.1.160 27 192.168.1.1
[r2]ip route-static 192.168.1.8 30 192.168.1.6  
[r2]ip route-static 192.168.1.12 30 192.168.1.6
[r2]ip route-static 192.168.1.16 30 192.168.1.6
[r2]ip route-static 192.168.1.20 30 192.168.1.1

R3

[r3]ip route-static 192.168.1.32 27 192.168.1.22
[r3]ip route-static 192.168.1.64 27 192.168.1.22
[r3]ip route-static 192.168.1.64 27 192.168.1.17
[r3]ip route-static 192.168.1.96 27 192.168.1.17
[r3]ip route-static 192.168.1.128 27 192.168.1.17
[r3]ip route-static 192.168.1.0 30 192.168.1.22  
[r3]ip route-static 192.168.1.4 30 192.168.1.17
[r3]ip route-static 192.168.1.8 30 192.168.1.17
[r3]ip route-static 192.168.1.12 30 192.168.1.17

R4

[r4]ip route-static 192.168.1.32 27 192.168.1.5
[r4]ip route-static 192.168.1.32 27 192.168.1.18
[r4]ip route-static 192.168.1.64 27 192.168.1.5 
[r4]ip route-static 192.168.1.128 27 192.168.1.10
[r4]ip route-static 192.168.1.128 27 192.168.1.13
[r4]ip route-static 192.168.1.160 27 192.168.1.18
[r4]ip route-static 192.168.1.0 30 192.168.1.5   
[r4]ip route-static 192.168.1.20 30 192.168.1.18

R5

[r5]ip route-static 192.168.1.32 27 192.168.1.9
[r5]ip route-static 192.168.1.32 27 192.168.1.14
[r5]ip route-static 192.168.1.64 27 192.168.1.9 
[r5]ip route-static 192.168.1.96 27 192.168.1.9
[r5]ip route-static 192.168.1.96 27 192.168.1.14
[r5]ip route-static 192.168.1.160 27 192.168.1.14
[r5]ip route-static 192.168.1.0 30 192.168.1.9
[r5]ip route-static 192.168.1.0 30 192.168.1.14
[r5]ip route-static 192.168.1.4 30 192.168.1.14
[r5]ip route-static 192.168.1.4 30 192.168.1.9 
[r5]ip route-static 192.168.1.16 30 192.168.1.14
[r5]ip route-static 192.168.1.20 30 192.168.1.14

ping通

ping R5失败

设置缺省使得R1-R5可访R6

[r1]ip route-static 0.0.0.0 0 192.168.1.2
[r1]ip route-static 0.0.0.0 0 192.168.1.21
[r2]ip route-static 0.0.0.0 0 192.168.1.6  
[r3]ip route-static 0.0.0.0 0 192.168.1.17
[r4]ip route-static 0.0.0.0 0 192.168.1.10    
[r4]ip route-static 0.0.0.0 0 192.168.1.13

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

电气 薛宇龙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值