DHCP地址自動獲取教你怎么玩
1、網絡拓撲
2、在相應設備上啟用DHCP服務
[SW1] dhcp enable
3、配置相應vlan,在對應vlan下加入對應的端口,進入vlan虛接口創建ip網關地址
[SW1]vlan 10
[SW1-vlan10]port GigabitEthernet 1/0/1
[SW1]vlan 20
[SW1-vlan20]port GigabitEthernet 1/0/2
[SW1]vlan 30
[SW1-vlan30]port GigabitEthernet 1/0/3
[SW1]interface vlan 10
[SW1-Vlan-interface10]ip address 192.168.10.254 255.255.255.0
[SW1]interface vlan 20
[SW1-Vlan-interface20]ip address 192.168.20.254 255.255.255.0
[SW1]interface vlan 30
[SW1-Vlan-interface30]ip address 192.168.30.254 255.255.255.0
4、創建DHCP地址池10、20、30用來為客戶端分配對應的網段IP地址
[SW1]dhcp server ip-pool 10
[SW1-dhcp-pool-10]network 192.168.10.0 mask 255.255.255.0
[SW1-dhcp-pool-10]gateway-list 192.168.10.254
[SW1-dhcp-pool-10]DNS-list 202.99.160.68 114.114.114.114
[SW1]dhcp server ip-pool 20
[SW1-dhcp-pool-20]network 192.168.20.0 mask 255.255.255.0
[SW1-dhcp-pool-20]gateway-list 192.168.20.254
[SW1-dhcp-pool-20]dns-list 202.99.160.68 114.114.114.114
[SW1]dhcp server ip-pool 30
[SW1-dhcp-pool-30]network 192.168.30.0 mask 255.255.255.0
[SW1-dhcp-pool-30]gateway-list 192.168.30.254
[SW1-dhcp-pool-30]dns-list 202.99.160.68 114.114.114.114
5、配置不參與自動分配的IP地址,留給打印機設備使用。
[SW1]dhcp server forbidden-ip 192.168.10.250
[SW1]dhcp server forbidden-ip 192.168.20.250
[SW1]dhcp server forbidden-ip 192.168.30.250
6、保存配置并重啟交換機
[SW1]save force
7、pc可以正常獲取到對應IP地址