一、拓扑实验图
二、实验要求 1.全网可达; 2.使用DHCP获取IP地址; 三、实验思路:
1.配置交换机,创建vlan更改交换机的接口链路类型配置trunk干道,放通vian
2.配置路由器,配置子接口,配置DHCP服务,在子接口下放dhcp服务 四、实验步骤
1.进入给三个个交换机创建两个虚拟广播域VLAN 2和VLAN 3
[SW1]vlan 2
[SW1-vlan2]quit
[SW1]vlan 3
SW2和SW3以此类推
2.更改交换机的接口链路类型 (1)设置access线路
在SW1内将0/0/2和0/0/3设置成Access链路
[SW1]int g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 2
[SW1-GigabitEthernet0/0/2]quit
[SW1]int g0/0/3
[SW1-GigabitEthernet0/0/3]port link-type access [SW1-GigabitEthernet0/0/3]port default vlan 3
以此类推将SW2内将0/0/3和0/0/4设置成Access链路 将SW3内将0/0/2和0/0/3设置成Access链路
(2)设置trunk线路
在SW1将0/0/1接口设置成Trunk链路,放通vian
[SW1]int g0/0/1 [SW1-GigabitEthernet0/0/1]port link-type trunk [SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
在SW2内,将0/0/1和0/0/2接口设置成Trunk链路,放通vian
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]port link-type trunk
[SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 3
在SW3内,将0/0/1接口设置成Trunk链路,放通vian
[SW3]int g0/0/1
[SW3-GigabitEthernet0/0/1]port link-type trunk [SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 33.配置路由器
(1)在R1路由器上创建虚拟接口;并配置合理的IP地址。在接口上开启802.1Q帧的识别传输服务,打开arp广播功能
路由器R1左边vlan2
[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip add 192.168.1.254 2 [R1-GigabitEthernet0/0/1.2]dot1q termination vid 2 [R1-GigabitEthernet0/0/0.2]arp broadcast enable
路由器R1左边vlan3
[R1-GigabitEthernet0/0/0.2]int g0/0/0.3
[R1-GigabitEthernet0/0/0.3]ip add 192.168.2.254 3
[R1-GigabitEthernet0/0/0.3]dot1q termination vid 3 [R1-GigabitEthernet0/0/0.3]arp broadcast enable
路由器R1右边vlan2
[R1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]ip add 192.168.3.254 2 [R1-GigabitEthernet0/0/1.2]dot1q termination vid 2 [R1-GigabitEthernet0/0/1.2]arp broadcast enable
路由器R1右边vlan3
[R1]int g0/0/1.3
[R1-GigabitEthernet0/0/1.3]ip add 192.168.4.254.3 [R1-GigabitEthernet0/0/1.3]dot1q termination vid 3 [R1-GigabitEthernet0/0/1.3]arp broadcast enable
(2)创建四个对应的IP池,在子接口下放dhcp服务
[R1]dhcp enable
[R1]ip pool aa
[R1]dhcp enable [R1-ip-pool-aa]network 192.168.1.0 mask 24
[R1-ip-pool-aa]gateway-list 192.168.1.254 [R1-ip-pool-aa]dns-list 8.8.8.8 114.114.114.114
再在另外三个接口上创建IP相应池,下放dhcp服务
(3)在电脑终端开启DHCP自动获取IP地址
(4)PC1对对路由器左边VLAN 3的PC2进行ping操作
选择PC1对路由器左边VLAN 2的PC3进行ping操作PC1对路由器右边VLAN 2的PC5进行ping操作PC1对路由器右边VLAN 3的PC6进行ping操作
实现全网通试验完成