iptables 配置 使用-3

企业实战使用

实战环境

CU:

ifconfig eth0 202.106.0.20 netmask 255.255.255.0

Client:

ifconfig eth0 192.168.0.1 netmask 255.255.255.0

route add default gw 192.168.0.254

Firewall:

ifconfig eth0 202.106.0.254 netmask 255.255.255.0

ifconfig eth1 192.168.0.254 netmask 255.255.255.0

service iptables stop

modprobe ip_nat_ftp

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

iptables -A INPUT -i lo -j ACCEPT

iptables -A INPUT -i eth1 -p tcp --dport 22 -j ACCEPT

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -P INPUT DROP

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 –o eth0 -j SNAT --to 202.106.0.254


实战二

CU:

ifconfig eth0 202.106.0.20 netmask 255.255.255.0

Server:

ifconfig eth0 172.17.0.1 netmask 255.255.255.0

route add default gw 172.17.0.254

Client:

ifconfig eth0 192.168.0.1 netmask 255.255.255.0

route add default gw 192.168.0.254

Firewall:

ifconfig eth0 202.106.0.254 netmask 255.255.255.0

ifconfig eth1 192.168.0.254 netmask 255.255.255.0

ifconfig eth2 172.17.0.254 netmask 255.255.255.0

service iptables stop

modprobe ip_nat_ftp

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

iptables -A INPUT -i lo -j ACCEPT

iptables -A INPUT -i eth1 -p tcp --dport 22 -j ACCEPT

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -P INPUT DROP

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 –o eth0 -j SNAT --to 202.106.0.254

iptables -t nat -A PREROUTING -d 202.106.0.254 -p tcp -dport 80 -j DNAT --to 172.17.0.1

iptables -A FORWARD -i eth2 -o eth1 -m state --state NEW -j DROP


CU:

ifconfig eth0 202.106.0.20 netmask 255.255.255.0

Server:

ifconfig eth0 172.17.0.1 netmask 255.255.255.0

route add default gw 172.17.0.254

Client:

ifconfig eth0 192.168.0.1 netmask 255.255.255.0

route add default gw 192.168.0.254

Firewall:

ifconfig eth0 202.106.0.254 netmask 255.255.255.0

ifconfig eth1 192.168.0.254 netmask 255.255.255.0

ifconfig eth2 172.17.0.254 netmask 255.255.255.0

service iptables stop

modprobe ip_nat_ftp

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

iptables -A INPUT -i lo -j ACCEPT

iptables -A INPUT -i eth1 -p tcp --dport 22 -j ACCEPT

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -P INPUT DROP

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 –o eth0 -j SNAT --to 202.106.0.254

iptables -t nat -A PREROUTING -d 202.106.0.254 -p tcp -dport 80 -j DNAT --to 172.17.0.1

iptables -A FORWARD -i eth2 -o eth1 -m state --state NEW -j DROP




本文转自 mailfile 51CTO博客,原文链接:http://blog.51cto.com/mailfile/1199231,如需转载请自行联系原作者
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值