灰儿 发表于 2021-8-31 11:54:44

神州数码交换机 DHCP 服务器配置命令

神州数码交换机 DHCP 服务器配置命令

手工绑定时,将IP地址10.1.128.160 与用户唯一标识为 00-10-5a-60-af-12 的用户绑定。
Switch(dhcp-1-config)#client-identifier 00-10-5a-60-af-12
Switch(dhcp-1-config)#host 10.1.128.160 24

用户唯一标识为00-10-5a-60-af-12 的用户设置用户名为network。
Switch(dhcp-1-config)#client-name network

设置DHCP 客户机的缺省网关为 10.1.128.2 和10.1.128.100。
Switch(dhcp-1-config)#default-router 10.1.128.2 10.1.128.100

设置DHCP 客户机的DNS 服务器的地址为 10.1.128.3。
Switch(dhcp-1-config)#dns-server 10.1.128.3

指定DHCP 客户机的域名为digitalchina.com.cn
Switch(dhcp-1-config)#domain-name digitalchina.com.cn

手工绑定时,将IP地址10.1.128.160与硬件地址为 00-00-e2-3a-26-04 的用户绑定。
Switch(dhcp-1-config)#hardware-address 00-00-e2-3a-26-04
Switch(dhcp-1-config)#host 10.1.128.160 24

关闭DHCP 服务器的日志功能。
Switch(Config)#no ip dhcp conflict logging

将10.1.128.1 到10.1.128.10 之间的地址保留,不用于动态分配。
Switch(Config)#ip dhcp excluded-address 10.1.128.1 10.1.128.10

定义一个地址池,取名1。
Switch(Config)#ip dhcp pool 1
Switch(dhcp-1-config)#

修改发ping 包的个数为5 个。
Switch(Config)#ip dhcp ping packets 5

修改超时时间为1 秒钟。
Switch(Config)#ip dhcp ping timeout 1000

打开DHCP 日志功能,日志主机为 192.168.1.101,端口号为 45。
Switch(Config)#loghost dhcp 192.168.1.101 45

DHCP 地址池1 的租期设置为3 天 12 个小时30 分钟。
Switch(dhcp-1-config)#lease 3 12 30

地址池1 的客户机的节点类型为广播型。
Switch(dhcp-1-config)#netbios-node-type b-node
b-node 为广播型;h-node 为先点对点后广播的混合型;m-node 为先广播后点对点的混合型;p-node为点对点型

地址池1 的可分配的地址为 10.1.128.0/24。
Switch(dhcp-1-config)#network-address 10.1.128.0 24

配置WWW 服务器的地址为10.1.128.240。
Switch(dhcp-1-config)#option 72 ip 10.1.128.240

打开DHCP 服务器。
Switch(Config)#service dhcp



DHCP 配置举例

为减轻网络管理员和用户的配置负担,现有某公司将 DCRS-5526S 作为DHCP 服务器。其Admin VLAN的IP 地址为10.16.1.2/24。其中公司局域网因为办公地点分成了A 地、B 地两部分,A 地、B 地的网络配置如下表。

PoolA(network 10.16.1.0)          PoolB(network 10.16.2.0)
设备             Ip 地址          设备             Ip 地址
缺省网关   10.16.1.200          缺省网关   10.16.2.200
             10.16.1.201                     10.16.2.201
DNS 服务器   10.16.1.202          DNS 服务器   10.16.2.202
Wins 服务器10.16.1.209          WWW 服务器   10.16.2.209
Wins 的节点类型   H-node   
Lease               3 天          Lease               1 天

其中在A处,因为工作的需要,特地将一台 MAC 地址为00-03-22-23-dc-ab的机器分配固定的IP 地址10.16.1.210,命名为management。

Switch(Config)#interface vlan 1
Switch(Config-Vlan-1)#ip address 10.16.1.2 255.255.255.0
Switch(Config-Vlan-1)#exit
Switch(Config)#ip dhcp pool A
Switch(dhcp-A-config)#network 10.16.1.0 24
Switch(dhcp-A-config)#lease 3
Switch(dhcp-A-config)#default-route 10.16.1.200 10.16.1.201
Switch(dhcp-A-config)#dns-server 10.16.1.202
Switch(dhcp-A-config)#netbios-name-server 10.16.1.209
Switch(dhcp-A-config)#netbios-node-type H-node
Switch(dhcp-A-config)#exit
Switch(Config)#ip dhcp excluded-address 10.16.1.200 10.16.1.210
Switch(Config)#ip dhcp pool B
Switch(dhcp-B-config)#network 10.16.2.0 24
Switch(dhcp-B-config)#lease 1
Switch(dhcp-B-config)#default-route 10.16.2.200 10.16.2.201
Switch(dhcp-B-config)#dns-server 10.16.2.202
Switch(dhcp-B-config)#option 72 ip 10.16.2.209
Switch(dhcp-config)#exit
Switch(Config)#ip dhcp excluded-address 10.16.2.200 10.16.2.210
Switch(Config)#ip dhcp pool A1
Switch(dhcp-A1config)#host 10.16.1.210
Switch(dhcp-A1-config)#hardware-address 0003.2223.dcab
Switch(dhcp-A1-config)#client-name management
Switch(dhcp-A1-config)#exit



DHCP Snooping配置
启动DHCP Snooping功能
Switch(Config)#ip dhcp snooping enable

启动DHCP Snooping绑定功能
Switch(Config)#ip dhcp snooping binding enable

在交换机端口 Ethernet0/0/16 配置静态绑定用户
Switch(Config)#ip dhcp snooping binding user 00-03-0f-12-34-56 address 192.168.1.16 255.255.255.0 vlan 1 interface Ethernet0/0/16

启动DHCP Snooping绑定 ARP 功能
Switch(Config)#ip dhcp snooping binding arp

在端口 ethernet1/1 启动绑定 DOT1X 功能
Switch(Config)#interface ethernet 0/0/1
Switch(Config- Ethernet 0/0/1)# ip dhcp snooping binding dot1x

在端口 ethernet1/1 启动绑定 USER功能
Switch(Config)#interface ethernet 0/0/1
Switch(Config- Ethernet 0/0/1)# ip dhcp snooping binding user-control
这个命令和 ip dhcp snooping binding dot1x 命令互斥

设置端口 ethernet0/0/1为 DHCP Snooping信任端口
Switch(Config)#interface ethernet 0/0/1
Switch(Config- Ethernet 0/0/1)#ip dhcp snooping trust

设置端口 ethernet0/0/1的 DHCP Snooping 防御动作为设置 blackhole,自动恢复时间为 30秒
Switch(Config)#interface ethernet 0/0/1
Switch(Config- Ethernet 0/0/1)#ip dhcp snooping action blackhole recovery 30

设置防御动作数目为 100
Switch(Config)#ip dhcp snooping action maxnum 100

设置交换机 DHCP 报文转发速率为 200pps
Switch(Config)#ip dhcp snooping limit-rate 200



DHCP Snooping典型应用举例:

Mac-AA 设备为正常用户,连接在 DCN交换机非信任端口 0/0/1上,其通过 DHCP
Client 活动 IP 1.1.1.5;DHCP Server 和 GateWay 连接在 DCN 交换机的信任端口0/0/11;0/0/12上;恶意用户Mac-BB连接在非信任端口 0/0/10 上,试图伪装 DHCP Server(发送 DHCPACK)。在交换机上设置 DHCP Snooping将能有效发现并阻止这种网络***
配置序列为:
Switch#config
Switch(Config)#ip dhcp snooping
Switch(Config)#interface ethernet 0/0/11
Switch(Config-Ethernet0/0/11)#ip dhcp snooping trust
Switch(Config-Ethernet0/0/11)#exit
Switch(Config)#interface ethernet 0/0/12
Switch(Config-Ethernet0/0/12)#ip dhcp snooping trust
Switch(Config-Ethernet0/0/12)#exit
Switch(Config)#interface ethernet 0/0/1-10
Switch(Config-Port-Range)#ip dhcp snooping action shutdown
Switch(Config-Port-Range)#



防 ARP 扫描功能命令
在交换机上启动防 ARP 扫描功能
Switch(Config)#anti-arpscan enable

在交换机上配置基于端口的防 ARP 扫描速率阈值为 20个/秒
Switch(Config)#anti-arpscan port-based threshold 20
如果接收的 ARP 报文的速率超过此设定值,则关闭此端口

在交换机上配置基于 IP 的防ARP 扫描速率阈值为 6个/秒
Switch(config)#anti-arpscan ip-based threshold 6

将交换机的端口 ethernet 0/0/5配置为信任端口
Switch(config)#interface ethernet0/0/5
Switch(Config-if-ethernet 0/0/5)#anti-arpscan trust port

将192.168.1.0/24 配置为信任 IP
Switch(config)#anti-arpscan trust ip 192.168.1.0 255.255.255.0

在交换机上启动自动恢复功能
Switch(config)#anti-arpscan recovery enable

设置自动恢复时间为 3600 秒。
Switch(config)#anti-arpscan recovery time 3600

在交换机上启动防 ARP扫描的日志功能。
Switch(config)#anti-arpscan log enable

在交换机上启动防 ARP扫描的 SNMP Trap 功能。
Switch(config)#anti-arpscan trap enable



转载于:https://blog.51cto.com/yyh654/1972312

页: [1]
查看完整版本: 神州数码交换机 DHCP 服务器配置命令