關閉Firewalld時,配置好了L2TP,鏈接上以後,只需將ppp0設備的包經過iptables的nat錶轉發出去便可:工具
iptables -t nat -A POSTROUTING -s 172.16.1.0/24 -o eth0 -j MASQUERADE
可是,若開啓Firewalld,即便我把ppp0加入開啓了masquerade的external區域,仍然沒法訪問Internet。spa
請問該如何配置轉發規則(最好使用firewall-cmd工具)?code
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p gre -j ACCEPT firewall-cmd --permanent --direct --add-rule ipv4 filter POSTROUTING 0 -t nat -o eth0 -j MASQUERADE firewall-cmd --reload
注意網卡名稱!blog