shell脚本搭建DHCP
时间: 2023-11-30 19:42:35 浏览: 140
以下是使用shell脚本搭建DHCP服务器的步骤:
1.安装dhcp软件包
```shell
yum install dhcp -y
```
2.配置dhcpd.conf文件
```shell
vi /etc/dhcp/dhcpd.conf
```
在文件中添加以下内容:
```
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.200;
option domain-name-servers 8.8.8.8;
option routers 192.168.0.1;
}
```
其中,subnet为子网地址,range为DHCP服务器分配的IP地址范围,option domain-name-servers为DNS服务器地址,option routers为网关地址。
3.启动dhcpd服务
```shell
systemctl start dhcpd
```
4.设置dhcpd服务开机自启动
```shell
systemctl enable dhcpd
```
5.查看dhcpd服务状态
```shell
systemctl status dhcpd
```
阅读全文
相关推荐















