一.实验拓扑
二.实验需求
1、全网可达;
2、使用DHCP获取IP地址;
三.实验思路
1.划分左右两边的vlan地址:
vlan 2:192.168.1.0/24
vlan 3:192.168.2.0/24
vlan 2:192.168.3.0/24
vlan 3:192.168.4.0/24
手动关闭日志<sw1>undo terminal monitor
2.给主机划dicp地址
3.给各个交换机创建vlan,更改接口链路类型,再把接口加入相应的vlan
4.sw2先配交换机上与其pc相连的两个
5.在sw1查vlan
在sw2查vlan
在sw3查表
6.开启dicp服务
四.实验步骤
1.
[sw1]vlan 2
[sw1-vlan2]quit
[sw1]vlan 3
[sw1-vlan3]quit
[sw2]vlan 2
[sw2-vlan2]quit
[sw2]vlan 3
[sw2-vlan3]quit
[sw3]vlan 2
[sw3-vlan2]
[sw3-vlan2]vlan 3
[sw3-vlan3]quit
2.
sw1]int e 0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 2
[sw1-Ethernet0/0/2]quit
[sw1]int e 0/0/3
[sw1-Ethernet0/0/3]port link-type access
[sw1-Ethernet0/0/3]port default vlan 3
[sw1-Ethernet0/0/2]quit
改成公共电路:
[sw1]int e 0/0/1
[sw1-Ethernet0/0/1]port link-ty trunk
[sw1-Ethernet0/0/1]port trunk
[sw1-port-group-trunk]quit
精确vlan:
[sw1]int e 0/0/1
[sw1-Ethernet0/0/1]port trunk allow-pass vlan 2 3
[sw1-Ethernet0/0/1]quit
[sw2]int e 0/0/3
[sw2-Ethernet0/0/3]port link-type access
[sw2-Ethernet0/0/3]port default vlan 2
[sw2-Ethernet0/0/3]quit
[sw2]int e 0/0/4
[sw2-Ethernet0/0/4]port link-type access
[sw2-Ethernet0/0/4]port default vlan 3
[sw2-Ethernet0/0/4]quit
[sw2]int e 0/0/2
[sw2-Ethernet0/0/2]port link-type trunk
[sw2-Ethernet0/0/2]port trunk allow-pass vlan 2 3
[sw2-Ethernet0/0/2]quit
[sw2]int e 0/0/1
[sw2-Ethernet0/0/1]port link-type trunk
[sw2-Ethernet0/0/1]port trunk allow-pass vlan 2 3
[sw2-Ethernet0/0/1]quit
[sw3]vlan 2
[sw3-vlan2]vlan 3
[sw3-vlan3]quit
[sw3]int e 0/0/2
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 2
[sw3-Ethernet0/0/2]quit
[sw3]int e 0/0/3
[sw3-Ethernet0/0/3]port link-type access
[sw3-Ethernet0/0/3]port default vlan 3
[sw3-Ethernet0/0/3]quit
sw3]int e 0/0/1
[sw3-Ethernet0/0/1]port link-type trunk
[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2 3
sw3-Ethernet0/0/1]quit
[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/0.2]dotlg termination vid 2
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
[R1-GigabitEthernet0/0/0.2]quit
[R1]int g0/0/0.3
[R1-GigabitEthernet0/0/0.3]ip add 192.168.2.254 24
[R1-GigabitEthernet0/0/0.3]dotlq termination vid 3
[R1-GigabitEthernet0/0/0.3]quit
[R1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]ip add 192.168.3.254 24
[R1-GigabitEthernet0/0/1.2]dot1q termination vid 2
[R1-GigabitEthernet0/0/1.2]arp broadcast enable
[R1-GigabitEthernet0/0/1.2]quit
[R1]int g0/0/1.3
[R1-GigabitEthernet0/0/1.3]ip add 192.168.4.254 24
[R1-GigabitEthernet0/0/1.3]dot1q termination vid 3
[R1-GigabitEthernet0/0/1.3]arp broadcast enable
[R1-GigabitEthernet0/0/1.3]qui
3.开启dhcp服务
[R1]dhcp enable
[R1]ip pool aa
Info: It's successful to create an IP address pool.
[R1-ip-pool-aa]
[R1-ip-pool-aa]
[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
[R1-ip-pool-aa]quit
[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dhcp select global
[R1-GigabitEthernet0/0/0.2]quit
[R1]ip pool bb
Info: It's successful to create an IP address pool.
[R1-ip-pool-bb]network 192.168.2.0 mask 24
[R1-ip-pool-bb]gateway-list 192.168.2.254
[R1-ip-pool-bb]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-bb]quit
R1]ip pool cc
Info: It's successful to create an IP address pool.
[R1-ip-pool-cc]network 192.168.3.0 mask 24
[R1-ip-pool-cc]gateway-list 192.168.3.254
[R1-ip-pool-cc]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-cc]quit
[R1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]dhcp select global
[R1-GigabitEthernet0/0/1.2]quit
[R1]ip pool dd
Info: It's successful to create an IP address pool.
[R1-ip-pool-dd]network 192.168.4.0 mask 24
[R1-ip-pool-dd]gateway-list 192.168.4.254
[R1-ip-pool-dd]dns-list 8.8.8.8 114.114.114.114
[R1-ip-pool-dd]quit
[R1]int g0/0/1.3
[R1-GigabitEthernet0/0/1.3]dhcp select global
[R1-GigabitEthernet0/0/1.3]quit