拓扑图及实验需求
1.pc1、pc3属于vlan 2
2.pc2、pc4属于vlan 3
3.通过DHCP使得PC获取IP地址信息
4.全网可达
实验分析
1.利用VLAN将广播域进行分割
2.网关手工配置,通过DHCP分配pc设备IP地址
3.创建虚拟接口,完成相应配置
4.检查所有设备是否联通
基础配置
DHCP配置
配置VLAN
//创建并划分vlan
[LSW1]vlan batch 2 3
[LSW1]int g0/0/2
[LSW1-GigabitEthernet0/0/2]port link-type access
[LSW1-GigabitEthernet0/0/2]port default vlan 2
[LSW1]interface g0/0/3
[LSW1-GigabitEthernet0/0/3]port link-type access
[LSW1-GigabitEthernet0/0/3]port default vlan 3
[LSW2]vlan batch 2 3
[LSW2]interface g0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type access
[LSW2-GigabitEthernet0/0/1]port default vlan 2
[LSW2]interface g0/0/2
[LSW2-GigabitEthernet0/0/2]port link-type access
[LSW2-GigabitEthernet0/0/2]port default vlan 3
配置lasw1与lasw2,R1通道
[LSW1]interface g0/0/4
[LSW1-GigabitEthernet0/0/4]port link-type trunk
[LSW1-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3
[LSW2]int g0/0/3
[LSW2-GigabitEthernet0/0/3]port link-type trunk
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 3
配置LSW1与R1的通道
[LSW1]interface g0/0/1
[LSW1-GigabitEthernet0/0/1]port link-type trunk
[LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
创建R1的子接口
[r1]interface g0/0/0.1
[r1-GigabitEthernet0/0/0.1]ip address 192.168.1.254 24
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]arp broadcast enable
[r1]interface g0/0/0.2
[r1-GigabitEthernet0/0/0.2]ip address 192.168.2.254 24
[r1-GigabitEthernet0/0/0.2]dot1q termination vid 3
[r1-GigabitEthernet0/0/0.2]arp broadcast enable
在子接口启动DHCP,将地址分配给vlan2 3中的pc端
[r1-GigabitEthernet0/0/0.1]dhcp select global
[r1-GigabitEthernet0/0/0.2]dhcp select global
检查联通
pc1访问pc2
访问pc3
访问pc4