[CISCO] DHCP on CISCO switch

這裡示範的是在 LAB 的一台 CISCO 3650 上做出 DHCP 的功能,假設我們的網段是 192.168.120.0,我希望把 15 個位於 192.168.120.224 ~ 192.168.120.238 之間 IP address 拿來指派用。
接下來是實際的設定了...

LAB3650#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
LAB3650(config)#ip dhcp excluded-address 192.168.120.1 192.168.120.223
LAB3650(config)#ip dhcp excluded-address 192.168.120.239 192.168.120.254
LAB3650(config)#ip dhcp pool v120
LAB3650((dhcp-config)#network 192.168.120.0 255.255.255.0
LAB3650((dhcp-config)#default-router 192.168.120.1
LAB3650((dhcp-config)#dns-server 168.95.1.1 192.72.22.54
LAB3650(config-if)#^Z
LAB3650#wr mem

接下來用 "sh run" 去看,應該會看到如下的部分:

ip dhcp excluded-address 192.168.120.1 192.168.120.223
ip dhcp excluded-address 192.168.120.239 192.168.120.254
!
ip dhcp pool v120
network 192.168.120.0 255.255.255.0
default-router 192.168.120.1
dns-server 168.95.1.1 192.72.22.54
0 Responses