pc1,pc2,pc4属于vlan2,pc3,pc5属于vlan3
思路:
1)创建vlan,将接口划入相应的vlan
2)配置trunk干道
3)路由器配置子接口
4)配置dhcp
配置命令:
sw1
sysname 1
vlan batch 2 to 3
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
interface GigabitEthernet0/0/2
port link-type access
port default vlan 2
interface GigabitEthernet0/0/3
port link-type access
port default vlan 2
interface GigabitEthernet0/0/4
port link-type access
port default vlan 3
interface GigabitEthernet0/0/5
port link-type trunk
port trunk allow-pass vlan 2 to 4094
sw2
sysname 2
vlan batch 2 to 3
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
interface GigabitEthernet0/0/2
port link-type access
port default vlan 2
interface GigabitEthernet0/0/3
port link-type access
port default vlan 3
ar1
dhcp enable
ip pool vid2
gateway-list 192.168.1.254
network 192.168.1.0 mask 255.255.255.0
dns-list 114.114.114.114 8.8.8.8
ip pool vid3
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
dns-list 114.114.114.114 8.8.8.8
interface GigabitEthernet0/0/0.1
dot1q termination vid 2
ip address 192.168.1.254 255.255.255.0
arp broadcast enable
dhcp select global
interface GigabitEthernet0/0/0.2
dot1q termination vid 3
ip address 192.168.2.254 255.255.255.0
arp broadcast enable
dhcp select global