网关上做DNS透明代理
#!/bin/sh cd /root/sysadm LOG="/root/sysadm/logs/upt_dns253.log" OLD_DNS=`/sbin/iptables -t nat -L -n | grep "udp dpt:53" | awk '{print $8}' | awk -F\: '{print $2}'` NEW_DNS=`cat /etc/resolv.conf | head -1 | awk '{print $2}'` if [ "$OLD_DNS" != "$NEW_DNS" ]; then /sbin/iptables -t nat -D PREROUTING -p udp -d 0.0.0.0/0 --dport 53 -j DNAT --to $OLD_DNS:53 /sbin/iptables -t nat -A PREROUTING -p udp -d 0.0.0.0/0 --dport 53 -j DNAT --to $NEW_DNS:53 echo `date "+%Y-%m-%d %H:%M:%S"` " Dns Proxy updating.. [$OLD_DNS -> $NEW_DNS]" >> $LOG fi
相关推荐
localhost0 2020-11-12
jlccwss 2020-09-11
lwplvx 2020-09-07
YzhilongY 2020-08-31
KevinXC 2020-08-12
oLeiShen 2020-08-01
dahege 2020-08-01
windzoone 2020-07-29
travelinrain 2020-07-27
hxf0 2020-07-10
oLeiShen 2020-06-25
oLeiShen 2020-06-25
dahege 2020-06-25
dahege 2020-06-22
MissFuTT 2020-06-21
ationwork 2020-06-16
kenson 2020-06-12
chwzmx 2020-06-09