首页 > 其他 > 详细

iptables1.35+squid3.0+tc搭建防火墙

时间:2016-07-19 14:05:45      阅读:237      评论:0      收藏:0      [点我收藏+]

iptables1.35+squid3.0+tc搭建防火墙

一、iptables配置

#启用内核IP 转发功能

vi /etc/sysctl.conf

修改为net.ipv4.ip_forward = 1

sysctl -p 生效

#清空filter 和nat 表规则

iptables -F

iptables -X

iptables -Z

iptables -F -t nat

iptables -X -t nat

iptables -Z -t nat

#透明代理(把80 端口的请求自动转发到3128)

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-ports 3128

#实现NAT 上网

iptables -t nat -A POSTROUTING -o eth1(外网网卡) -j SNAT --to IP(固定IP)

修改配置文件如下(注意注释部分不用写):

vi /etc/sysconfig/iptables

:INPUT DROP [13:1578]

:FORWARD DROP [0:0]

:OUTPUT ACCEPT [69:8936]

#设置默认规则

 详细请看附件

本文出自 “王国” 博客,请务必保留此出处http://4166616.blog.51cto.com/4156616/1827614

iptables1.35+squid3.0+tc搭建防火墙

原文:http://4166616.blog.51cto.com/4156616/1827614

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!