当前位置:首页 > 操作系统 > Linux

Linux启用nat路由

此配置为精简配置,若要基于安全考虑,请详细设置iptables的策略

eth0 为外网接口,eth1 为内网接口

intranet --> eth1 --> nat --> eth0 -->internet

vim /etc/sysctl.conf
    net.ipv4.ip_forward=1
sysctl -p
iptables -F
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t filter -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -t filter -A FORWARD -o eth1 -i eth0 -j ACCEPT
service iptables save

本文出自 “foolishfish” 博客,请务必保留此出处http://foolishfish.blog.51cto.com/3822001/1416726

原文:http://foolishfish.blog.51cto.com/3822001/1416726


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐