在 Linux 中停止 DHCP 服务的方法取决于你使用的是哪种 DHCP 服务器软件 和 Linux 发行版。下面是最常见的几种情况。
dhcpd,最常见)which dhcpd
sudo systemctl stop isc-dhcp-server
sudo systemctl stop dhcpd
sudo systemctl disable isc-dhcp-server # Ubuntu/Debian
sudo systemctl disable dhcpd # CentOS/RHEL
systemctl status isc-dhcp-server
# 或
systemctl status dhcpd
sudo systemctl stop dnsmasq
sudo systemctl disable dnsmasq
systemctl status dnsmasq
⚠️ 仅用于紧急情况或测试环境:
sudo pkill dhcpd
# 或
sudo killall dhcpd
sudo ss -ulnp | grep :67
# 或
sudo netstat -ulnp | grep :67
如果 没有输出,说明 DHCP 服务已停止。
systemctl list-units --type=service | grep -E "dhcp|dnsmasq"
sudo !!
| 场景 | 命令 |
|---|---|
| 停止 ISC DHCP | systemctl stop isc-dhcp-server |
| 停止 dnsmasq | systemctl stop dnsmasq |
| 禁止开机启动 | systemctl disable 服务名 |
| 查看状态 | systemctl status 服务名 |
如果你愿意,可以告诉我:
dhcpd 还是 dnsmasq我可以给你精确到命令级别的操作方案。