DHCP地址自动获取教你怎么玩
1、网络拓扑
2、在相应设备上启用DHCP服务
[SW1] dhcp enable
3、配置相应vlan,在对应vlan下加入对应的端口,进入vlan虚接口创建ip网关地址
[SW1]vlan 10
[SW1-vlan10]port GigabitEthe.NET 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地址