实验题目:
要求及分析
1.全网可达
2.PC通过DHCP获取地址
分析:图中共有4个广播域,通过DHCP全局地址池下放IP,需要4个地址池,图中路由器有2个物理接口,所以需要4个子接口来管理不同的vlan。
路由器配置
DHCP全局地址池分配
[R1]dhcp enable
[R1]ip pool 111
Info: It's successful to create an IP address pool.
[R1-ip-pool-111]network 192.168.1.0 mask 24
[R1-ip-pool-111]gateway-list 192.168.1.254
[R1-ip-pool-111]dns-list 1.1.1.1
[R1-ip-pool-111]q
[R1]in g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]dhcp select global
[R1-GigabitEthernet0/0/0.1]
[R1]ip pool 222
Info: It's successful to create an IP address pool.
[R1-ip-pool-222]network 192.168.2.0 mask 24
[R1-ip-pool-222]gateway-list 192.168.2.254
[R1-ip-pool-222]dns-list 1.1.1.1
[R1-ip-pool-222]
[R1-ip-pool-222]q
[R1]in g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dhcp select global
[R1-GigabitEthernet0/0/0.2]q
[R1]ip pool 333
Info: It's successful to create an IP address pool.
[R1-ip-pool-333]network 192.168.3.0 mask 24
[R1-ip-pool-333]gateway-list 192.168.3.254
[R1-ip-pool-333]dns-list 1.1.1.1
[R1-ip-pool-333]
[R1-ip-pool-333]q
[R1]in g0/0/1.1
[R1-GigabitEthernet0/0/1.1]dhcp select global
[R1-GigabitEthernet0/0/1.1]
[R1-GigabitEthernet0/0/1.1]q
[R1]ip pool 444
Info: It's successful to create an IP address pool.
[R1-ip-pool-444]network 192.168.4.0 mask 24
[R1-ip-pool-444]gateway-list 1.1.1.1
Error:The network section should be within the subnet of the pool.
[R1-ip-pool-444]gateway-list 192.168.4.254
[R1-ip-pool-444]dns-list 1.1.1.1
[R1-ip-pool-444]
[R1-ip-pool-444]q
[R1]in g0/0/1.2
[R1-GigabitEthernet0/0/1.2]dhcp select global
[R1-GigabitEthernet0/0/1.2]q
[R1]
PC获取IP
PC1的IP
PC2的IP
PC3的IP
PC3的IP
交换机配置
<Huawei>sys
[Huawei]sys sw1
[sw1]vlan batch 10 20
[sw1]in g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type trunk
[sw1-port-group-de]port trunk allow-pass vlan 10 20
[sw1]in g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]port default vlan 10
[sw1-GigabitEthernet0/0/2]in g0
[sw1-GigabitEthernet0/0/3]q
[sw1]in g0/0/3
[sw1-GigabitEthernet0/0/3]port link-type access
[sw1-GigabitEthernet0/0/3]port default vlan 20
[sw1-GigabitEthernet0/0/3]q
<Huawei>sys
[Huawei]sys sw2
[sw2]vlan batch 10 20
[sw2]in g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type trunk
[sw2-GigabitEthernet0/0/1]port trunk allow-pass v
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[sw2]in g0/0/2
[sw2-GigabitEthernet0/0/2]port link-type access
[sw2-GigabitEthernet0/0/2]q
[sw2]in g0/0/2
[sw2-GigabitEthernet0/0/2]p
[sw2-GigabitEthernet0/0/2]port default vlan 20
[sw2-GigabitEthernet0/0/2]q
[sw2]in g0/0/3
[sw2-GigabitEthernet0/0/3]port link-type access
[sw2-GigabitEthernet0/0/3]port default vlan 20
[sw2-GigabitEthernet0/0/3]q
全局通信
PC 1 ping 192.168.2.253
192.168.3.253
192.168.4.253
PC2 ping 192.168.1.253
192.168.3.253
192.168.4.253