一、拓扑图
二、需求
1、PC1、PC3属于VLAN 2
2、PC2、PC4属于VLAN3
3、通过DHCP使得pc获取IP地址信息
4、全网可达
三、需求分析
1、DHCP配IP
2、创建vlan,并将交换机接口划到vlan内部
3、子网划分
4、创建子接口
四、配置截图或文字
1、DHCP配IP
[r5]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r5]ip pool aa
Info: It's successful to create an IP address pool.
[r5-ip-pool-aa]network 192.168.1.0 mask 24
[r5-ip-pool-aa]gateway-list 192.168.1.100
[r5-ip-pool-aa]dns-list 8.8.8.8
[r5-ip-pool-aa]lease day 3 hour 0 minute 0
[r5-GigabitEthernet0/0/0]dhcp select global
[r5-GigabitEthernet0/0/0]q
2、创建vlan,并将交换机接口划到vlan内部
R2
[lsw4]vlan 2
[lsw4-vlan2]q
[lsw4]vlan 3
[lsw4-vlan3]q
[lsw2]in g 0/0/3
[lsw2-GigabitEthernet0/0/3]port link-type access
[lsw2-GigabitEthernet0/0/3]port default vlan 2
[lsw2-GigabitEthernet0/0/3]q
[lsw2-vlan3]q
[lsw2]in g 0/0/4
[lsw2-GigabitEthernet0/0/4]port link-type access
[lsw2-GigabitEthernet0/0/4]port default vlan 3
[lsw2-GigabitEthernet0/0/4]q
R3
[lsw3]vlan 2
[lsw3-vlan2]q
[lsw3]vlan 3
[lsw3-vlan3]q
[lsw3]in g 0/0/2
[lsw3-GigabitEthernet0/0/2]port link-type access
[lsw3-GigabitEthernet0/0/2]port default vlan 2
[lsw3-GigabitEthernet0/0/2]q
[lsw3]in g 0/0/3
[lsw3-GigabitEthernet0/0/3]port link-type access
[lsw3-GigabitEthernet0/0/3]port default vlan 3
[lsw3-GigabitEthernet0/0/3]q
3、子网划分
192.168.1.0/24
vlan2===192.168.1.0/25
vlan3===192.168.1.128/25
4、创建子接口
[r5]interface GigabitEthernet 0/0/0.2
[r5-GigabitEthernet0/0/0.2]ip ad 192.168.1.0 25
[r5-GigabitEthernet0/0/0.2]dot1q termination vid 2
[r5-GigabitEthernet0/0/0.2]arp broadcast enable
[r5-GigabitEthernet0/0/0.2]q
[r5]in g 0/0/0.3
[r5-GigabitEthernet0/0/0.3]ip ad 192.168.1.128 25
[r5-GigabitEthernet0/0/0.3]dot1q termination vid 3
[r5-GigabitEthernet0/0/0.3]arp broadcast enable
[r5-GigabitEthernet0/0/0.3]
全网通
PC1
PC2
PC3
PC4