Linux运维工程师技术文档十(DNS转发器)

192.168.10.253

Host3安装并配置Squid代理服务器,实现透明代理,可以同时代理http和https访问,配置成功后截图

yum -y install squid

ip address

cd /etc/squid/

cd

WAN口

iptables  -t  nat -A POSTROUTING  -o ens37 -j  MASQUERADE         出口  eth1

LAN口

针对局域网,进口,

iptables  -t nat -A PREROUTING -s 192.168.10.0/24 -j  DNAT  -p tcp –dport 53        进口 eth0

–to 172.16.1.1

iptables  -t nat -A PREROUTING -s 192.168.10.0/24 -j  DNAT  -p udp –dport 53       进口

–to 172.16.1.1

查询一下    

iptables -L  

iptables -L -t nat

systemctl start squid

systemctl status squid

squid相当于路由器了,包转发

 echo 1 > /proc/sys/net/ipv4/ip_forward

cat /proc/sys/net/ipv4/ip_forward

进入192.168.10.10 (DNS)

  vim /ect/named.conf

      

forward first 先自己解析,

systemctl restart named

systemctl status named

vim /etc/named.conf

systemctl restart named

资源下载: