
dhcp(config-vlan)#name sales
dhcp(config-vlan)#vlan 3
dhcp(config-vlan)#name markering
dhcp(config)#
dhcp(config)#int vlan 2
dhcp(config-if)#ip add 192.168.20.1 255.255.255.0
dhcp(config-if)#int vlan 3
dhcp(config-if)#ip add 192.168.30.1 255.255.255.0
dhcp(config-if)#
dhcp(config)#
dhcp(config)#int f0/2
dhcp(config-if)#swit mode acc
dhcp(config-if)#swi acc vlan 2
dhcp(config-if)#int f0/3
dhcp(config-if)#swit mode acc
dhcp(config-if)#swi acc vlan 3
dhcp(config)#serv dhcp /开启dhcp服务/
dhcp(config)#ip dhcp excluded-address 192.168.20.1
dhcp(config)#ip dhcp excluded-address 192.168.30.1
dhcp(config)#
dhcp(config)#ip DHCp pool vlan2
dhcp(dhcp-config)#network 192.168.20.0 255.255.255.0
dhcp(dhcp-config)#default-router 192.168.20.1
dhcp(dhcp-config)#dns-server 202.96.209.133
dhcp(config)#ip dhcp pool vlan3
dhcp(dhcp-config)#ne 192.168.30.0 255.255.255.0
dhcp(dhcp-config)#default-router 192.168.30.1
dhcp(dhcp-config)#dns-server 202.96.209.133
dhcp(dhcp-config)#
检查dhcp服务
dhcp#sh ip dhcp binding
IP address Client-ID/ Lease expiration Type
Hardware address
192.168.20.2 00E0.A343.3A4C -- Automatic
192.168.30.2 0003.E489.A3D2 -- Automatic
dhcp#sh run
!
hostname dhcp
!
!
ip dhcp excluded-address 192.168.20.1
ip dhcp excluded-address 192.168.30.1
!
ip dhcp pool vlan2
network 192.168.20.0 255.255.255.0
default-router 192.168.20.1
dns-server 202.96.209.133
ip dhcp pool vlan3
network 192.168.30.0 255.255.255.0
default-router 192.168.30.1
dns-server 202.96.209.133
!
!
spanning-tree mode pvst
!
interface FastEthernet0/1
!
interface FastEthernet0/2
switchport access vlan 2
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 3
switchport mode access
!
interface FastEthernet0/4
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
interface Vlan2
mac-address 0007.ecb3.7601
ip address 192.168.20.1 255.255.255.0
!
interface Vlan3
mac-address 0007.ecb3.7602
ip address 192.168.30.1 255.255.255.0
!
!
end