Centos6.4如何安装dnsmasq

2023-04-18 05:02:00 centos6 安装 dnsmasq

Centos6.4安装dnsmasq的步骤:

1、首先需要安装dnsmasq,可以使用yum命令安装:

$ sudo yum install dnsmasq

2、接下来需要配置dnsmasq,配置文件位于/etc/dnsmasq.conf,需要添加以下内容:

# listen-address is the local IP address to listen on
listen-address=127.0.0.1
# port is the port to listen on
port=53
# bind-interfaces will make dnsmasq bind only to the interfaces it is listening on
bind-interfaces
# domain is the local domain name to use
domain=example.com
# dhcp-range is the range of IP addresses to give out
dhcp-range=192.168.1.100,192.168.1.200,12h

3、添加DNS服务器,需要在配置文件中添加以下内容:

# DNS servers are the IP addresses of the DNS servers to use
server=8.8.8.8
server=8.8.4.4

4、启动dnsmasq服务:

$ sudo service dnsmasq start

5、最后,需要将DNS服务器设置为dnsmasq,在/etc/resolv.conf中添加以下内容:

# DNS servers are the IP addresses of the DNS servers to use
nameserver 127.0.0.1

以上就是Centos6.4安装dnsmasq的步骤,只要按照步骤操作,就可以成功安装dnsmasq。

相关文章