思科DHCP
SW3:
en
conf t
hostname SW3
vlan 10
vlan 20
int e0/1
switch mode acc
switch acc vlan 10
int e0/2
switch mode acc
switch acc vlan 20
int e0/0
switch trunk en dot1q
switch mode trunk
switch trunk allow vlan 10,20
SW4:
en
conf t
hostname SW4
vlan 30
vlan 40
int e0/2
switch mode acc
switch acc vlan 30
int e0/1
switch mode acc
switch acc vlan 40
int e0/0
switch trunk en dot1q
switch mode trunk
switch trunk allow vlan 30,40
SW2:
en
conf t
hostname SW2
vlan 30
vlan 40
vlan 100
int e0/1
switch trunk en dot1q
switch mode trunk
switch trunk allow vlan 30,40
int vlan 30
ip add 192.168.3.254 255.255.255.0
no shut
ip help 12.1.1.1
int vlan 40
ip add 192.168.4.254 255.255.255.0
no shut
ip help 12.1.1.1
int e0/0
switch mode acc
switch acc vlan 100
int vlan 100
ip add 12.1.1.2 255.255.255.0
no shut
ip route 0.0.0.0 0.0.0.0 12.1.1.1
R1:
en
conf t
hostname R1
int e0/0
ip add 12.1.1.1 255.255.255.0
no shut
int e0/2
no shut
int e0/2.10
en dot1q 10
ip add 192.168.1.254 255.255.255.0
no shut
int e0/2.20
en dot1q 20
ip add 192.168.2.254 255.255.255.0
no shut
ip dhcp pool vlan10
network 192.168.1.0 255.255.255.0
default 192.168.1.254
dns 8.8.8.8
ip dhcp pool vlan20
network 192.168.2.0 255.255.255.0
default 192.168.2.254
dns 8.8.8.8
ip dhcp pool vlan30
network 192.168.3.0 255.255.255.0
default 192.168.3.254
dns 8.8.8.8
ip dhcp pool vlan40
network 192.168.4.0 255.255.255.0
default 192.168.4.254
dns 8.8.8.8
ip route 0.0.0.0 0.0.0.0 12.1.1.2