Chinaunix

标题: iptables如何转换firewalld命令 [打印本页]

作者: eremiter    时间: 2017-03-21 13:44
标题: iptables如何转换firewalld命令
  1. iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j SNAT --to-source 你的公网IP
  2. iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
复制代码

现在centos7已经改用firewalld ,更容易理解,更好用,网上几乎老linux人员,不思进取,教程基本延用iptables,新人想使用最先进的知识,搜索半天,不知如何改用firewalld
请大神指点



作者: eremiter    时间: 2017-03-21 15:00
感谢热心的雨落哥指点,问题解决,为了别人,特此分享
  1. firewall-cmd --permanent --direct --passthrough ipv4 -t nat -A POSTROUTING -s 192.168.10.0/24 -j SNAT --to-source 你的公网ip
  2. firewall-cmd --permanent --direct --passthrough ipv4 -t nat -A POSTROUTING -s 192.168.10.0/24 -o eth0 -j MASQUERADE
复制代码

作者: blackfriday13    时间: 2017-03-21 16:31
直接用iptables 命令好像也可以的吧?  好像iput表是可以的
作者: niao5929    时间: 2017-03-21 18:53
命令执行结束了,可以使用iptables看看结果哦。哈哈
作者: qq58945591    时间: 2017-03-22 23:32
其实,如果仅仅是做nat 的话, 更简单的是
  1. firewall-cmd --permanent --add-masquerade
复制代码







欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2