目录
一、拓扑图
二、需求分析
1.PC 1、PC 3属于VLAN 2
2.PC 2、PC 4属于VLAN3
3.通过DHCP使得PC获得IP地址信息
4.全网可达
三、配置过程
1.PC 1、PC 3属于VLAN 2
2.PC 2、PC 4属于VLAN3
[SW2]int g 0/0/2
[SW2-GigabitEthernet0/0/2]port link-type access
[SW2-GigabitEthernet0/0/2]po de v 2
[SW2-GigabitEthernet0/0/2]int g 0/0/3
[SW2-GigabitEthernet0/0/3]po li ac
[SW2-GigabitEthernet0/0/3]po de v 3
[SW2]int g 0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
[SW1]int g 0/0/3
[SW1-GigabitEthernet0/0/3]port link-type access
[SW1-GigabitEthernet0/0/3]po de v 2
[SW1]int g 0/0/4
[SW1-GigabitEthernet0/0/4]port li ac
[SW1-GigabitEthernet0/0/4]po de v 3
[SW1]int g 0/0/2
[SW1-GigabitEthernet0/0/2]po li t
[SW1-GigabitEthernet0/0/2]po tr allow-pass vlan 2 3
[SW1-GigabitEthernet0/0/2]int g 0/0/1
[SW1-GigabitEthernet0/0/1]po li t
[SW1-GigabitEthernet0/0/1]po t all v 2 3
[SW1-GigabitEthernet0/0/1]q
3.通过DHCP使得PC获得IP地址信息
[R1]dhcp en
[R1]ip poo vlan2
[R1-ip-pool-vlan2]network 192.168.2.0 mask 24
[R1-ip-pool-vlan2]gateway-list 192.168.2.254
[R1-ip-pool-vlan2]dns-list 8.8.8.8
[R1]ip poo vlan3
[R1-ip-pool-vlan3]network 192.168.3.0 mask 24
[R1-ip-pool-vlan3]gateway-list 192.168.3.254
[R1-ip-pool-vlan3]dns-list 8.8.8.8
[R1]int g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]arp broadcast en
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[R1-GigabitEthernet0/0/0.1]arp broadcast en
[R1-GigabitEthernet0/0/0.1]dhcp se g
[R1-GigabitEthernet0/0/0.1]int g 0/0/0.2
[R1-GigabitEthernet0/0/0.2]ip add 192.168.3.254 24
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 3
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
[R1-GigabitEthernet0/0/0.2]dhcp select g
[R1-GigabitEthernet0/0/0.2]q
[R1]