Cisco 的 DHCP 服务器太难用了,查询起来不直观,要设置个固定的 release 累死人。Linux 上那一堆 DHCP daemon 也没好到哪里去。想了想作为 DHCP 服务器的话,最直观方便的也就 RouterOS 了。简要记述一下把 RouterOS 作为远程 DHCP 服务器(不接入客户端所在二层)的配置方法。
配置
三层交换机(Cisco IOS):首先我们关闭 ip helper 对除 DHCP 以外其它协议的转发;然后在接口上设置 helper address 为 RouterOS 的 IP 地址即可。
|
no ip forward-protocol udp interface Vlan100 ip address 192.168.1.1 255.255.255.0 ip helper-address 192.168.0.2 |
RouterOS:对每个 DHCP server 配置,接口设置为转发包的来源接口,relay 设置为三层交换机面向 DHCP 客户端的内网端口的 IP。
|
/ip pool add name=dhcp ranges=192.168.1.10-192.168.1.254 /ip dhcp-server add address-pool=dhcp conflict-detection=no disabled=no interface=bridge name=user-vlan relay=192.168.1.1 /ip dhcp-server network add address=192.168.1.0/24 gateway=192.168.1.1 netmask=24 |
调试
Cisco IOS 上可以用 debug ip dhcp server packet
和 debug ip dhcp server events
看到每个请求的转发过程。
RouterOS DHCP lease 里面出现大量 busy 是因为 conflict detection 没有关闭,这种配置下 conflict detection 时间很长,可能会导致部分客户端超时以后疯狂重试,进而吃光 DHCP 地址池。因此参考配置里面关掉了 conflict detection。
参考: