軟件部訪問外網時使用squid代理
[root@localhost ~]# iptables -t nat -A PREROUTING -m iprange --src-range 192.168.20.21-192.168.20.30 -p tcp --dport 80 -j REDIRECT --to-port 3128
編輯squid配置文件
允許流量通過squid端口進入防火墻查看緩存
[root@localhost ~]# iptables -t filter -A INPUT -p tcp --dport 3128 -j ACCEPT
[root@localhost ~]# iptables -t filter -A INPUT -m state --state ESTABLISHED -j ACCEPT
允許squid使用自己的地址去訪問外部網絡
[root@localhost ~]# iptables -t filter -A OUTPUT -p tcp --dport 80 -j ACCEPT
[root@localhost ~]# iptables -t filter -A OUTPUT -m state --state ESTABLISHED -j ACCEPT
允許軟件部和經理辦通過eth2的流量能夠使用外部dns
[root@localhost ~]# iptables -t filter -A FORWARD -m iprange --src-range 192.168.20.21-192.168.20.40 -p udp --dport 53 -o eth2 -j ACCEPT
[root@localhost ~]# vim /etc/resolv.conf
[root@localhost ~]# vim /etc/squid/squid.conf
[root@localhost ~]# iptables -t filter -A OUTPUT -p udp --dport 53 -j ACCEPT
[root@localhost ~]# vim /etc/squid/squid.conf
[root@localhost ~]# vim /etc/squid/squid.conf
[root@localhost ~]# vim /etc/squid/squid.conf
經理辦上班時間不受限制
[root@localhost ~]# iptables -t filter -A FORWARD -m iprange --src-range 192.168.20.31-192.168.20.40 -m time --timestart 08:00 --timestop 20:00 --weekdays Mon,Tue,Wed,Thu,Fri -p tcp --dport 80 -o eth2 -j ACCEPT
DMZ
允許來自eth2端口的訪問能夠訪問到dmz區(qū)域的192.168.3.200的3389端口
[root@localhost ~]# iptables -t nat -A PREROUTING -i eth2 -d 192.168.102.200 -p tcp --dport 3389 -j DNAT --to 192.168.3.200
[root@localhost ~]# iptables -t filter -A FORWARD -d 192.168.3.200 -p tcp --dport 3389 -j ACCEPT