实验要求
实验分析
1.基于192.168.1.0/24进行划分,根据拓扑图来看,有两个vlan域,只需要2个网段,网络号借一位
2.pc1,pc3为access接口,且都在VLAN2,在同一个网段192.168.1.0/25
pc2,pc4为access接口,且都在VLAN3,在同一个网段192.168.1.128/25
3.交换机之间所有流量都需经过,所以将其接口类型设置为trunk模式,允许所有VLAN通过。
4.交换机R1中创建两个子接口分别让VLAN2和VLAN3通过。
5.全部配置完成后再用DHCP自动花去IP地址
配置内容
SW1
创建vlan2 vlan3
[SW1]vlan 2
[SW1-vlan2]
[SW1-vlan2]q
[SW1]vlan 3
[SW1-vlan3]q进入3,4端口,设置为access模式,并链接相应VLAN
[SW1]int g0/0/3
[SW1-GigabitEthernet0/0/3]port link-type access
[SW1-GigabitEthernet0/0/3]port default vlan 2
[SW1-GigabitEthernet0/0/3]int g0/0/4
[SW1-GigabitEthernet0/0/4]port link-type access
[SW1-GigabitEthernet0/0/4]port default vlan 3进入1,2接口,设置为truck模式,并允许所有流量通过
[SW1]int g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type trunk
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
display vlan
SW2
创建vlan2 vlan3
[SW2]vlan 2
[SW2-vlan2]
[SW2-vlan2]q
[SW2]vlan 3
[SW2-vlan3]q进入2,3端口,设置为access模式,并链接相应VLAN
[SW2]interface g0/0/2
[SW2-GigabitEthernet0/0/2]port link-type access[SW2-GigabitEthernet0/0/2]port default vlan 2
[SW2]int g0/0/3
[SW2-GigabitEthernet0/0/3]port link-type access
[SW2-GigabitEthernet0/0/3]port default vlan3进入1,2接口,设置为truck模式,并允许所有流量通过
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass all
display vlan
R1
分别进入0.1,0.2子端口
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip address 192.168.1.1 25 配置子端口的ip
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2 标记vlan2的流量
[R1-GigabitEthernet0/0/0.1]arp broadcast enable 开启arp广播机制[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip address 192.168.1.129 25 配置子端口的ip[R1-GigabitEthernet0/0/0.2]dot1q termination vid 3 标记vlan3的流量
[R1-GigabitEthernet0/0/0.2]arp broadcast enable 开启arp广播机制
开启DHCP地址池
[R1]dhcp enable创建两个地址池并配置相应内容,设置成DHCP节点,链接相应端口
[R1]ip pool AA
[R1-ip-pool-AA]netbios-type
[R1-ip-pool-AA]network 192.168.1.0 mask 25
[R1-ip-pool-AA]gateway-list 192.168.1.1
[R1]interface g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dhcp select global
[R1]ip pool BB
[R1-ip-pool-BB]netbios-type
[R1-ip-pool-BB]network 192.168.1.128 mask 25
[R1-ip-pool-BB]gateway-list 192.168.1.129[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dhcp select global