博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ZZ Quick-Tip: Linux NAT in Four Steps using iptables
阅读量:2436 次
发布时间:2019-05-10

本文共 1205 字,大约阅读时间需要 4 分钟。

4步搞定linux nat,其中eth0是外网口,eth1是内网口

1、First you need to tell your kernel that you want to allow IP forwarding.

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

Then you’ll need to configure iptables to forward the packets from your internal network, on /dev/eth1, to your external network on /dev/eth0.

2、You do this will the following commands:

/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

/sbin/iptables -A FORWARD -i eth0 -o eth1 -m state –state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
You should now be NATing. You can test this by pinging an external address from one of your internal hosts. The last step is to ensure that this setup survives over a reboot. Obviously you should only do these last two steps if your test is a success.

3、You will need to edit /etc/sysconfig/iptables-config and make sure IPTABLES_MODULES_UNLOAD, IPTABLES_SAVE_ON_STOP, and IPTABLES_SAVE_ON_RESTART are all set to ‘yes’.

4、设置iptables自动启动

After all that is done, you should probably do a test reboot to ensure that you’ve done everything correctly. If you find any errors on this page or this does not work for you please feel free to E-mail me directly at frank@revsys.com.

转载地址:http://wqqmb.baihongyu.com/

你可能感兴趣的文章
Metalink
查看>>
Asktom
查看>>
顺德美食之皆大欢喜
查看>>
Oracle10g自动宕机
查看>>
项目管理随笔(8)
查看>>
顺德美食之新松记
查看>>
Tahiti
查看>>
养一只好基
查看>>
电影-007
查看>>
广州美食-天使简约
查看>>
年后,挪窝的人可不少
查看>>
升级Oracle10.2.0.1
查看>>
现在的人太有才了
查看>>
运维,漫长,疲惫
查看>>
压力之下的Oracle10.1.0.X
查看>>
顺德美食-有骨气
查看>>
ORA-02049
查看>>
expdp的Exclude
查看>>
expdp出错(2)
查看>>
数据库startup时发生ora-600错误的傻瓜手册
查看>>