7.2-DHCP基本配置

一、基于接口:
R1:
[R1]dhcp enable
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.31.1 24
[R1-GigabitEthernet0/0/0]dhcp select interface
[R1-GigabitEthernet0/0/0]dhcp server dns-list 8.8.8.8 8.8.4.4
此时主机PC1、PC2、PC3均可自动获取IP地址、网关和DNS。
二、基于地址池
R1:
[R1]dhcp enable
[R1]ip pool 1
[R1-ip-pool-1]network 192.168.31.0 mask 255.255.255.0
[R1-ip-pool-1]gateway-list 192.168.31.1
[R1-ip-pool-1]dns-list 8.8.8.8 8.8.8.4
[R1-ip-pool-1]qu
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.31.1 24
[R1-GigabitEthernet0/0/0]dhcp select global
从DHCP地址池中排除IP地址段192.168.31.200 ~ 192.168.31.254
[R1]ip pool 1
[R1-ip-pool-1]excluded-ip-address 192.168.31.200 192.168.31.254
此时主机PC1、PC2、PC3均可自动获取IP地址(从地址池已排除的IP地址无法获取)、网关和DNS。
本文链接:https://www.orcy.net.cn/2775.html,转载请附上原文出处链接
发表评论