centos7 firewall 一些用法

Posted zhenfei

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 firewall 一些用法相关的知识,希望对你有一定的参考价值。

[5]For exmaple, Configure that outgoing packets through the Server from Internal network(10.0.0.0/24) are allowed and forwarded to External side.

# set masquerading to internal zone
[root@dlp ~]# firewall-cmd --zone=internal --add-masquerade --permanent
success
[root@dlp ~]# firewall-cmd --reload
success
[root@dlp ~]# firewall-cmd --direct --add-rule ipv4 nat POSTROUTING 0 -o eth1 -j MASQUERADE
[root@dlp ~]# firewall-cmd --direct --add-rule ipv4 filter FORWARD 0 -i eth0 -o eth1 -j ACCEPT
[root@dlp ~]# firewall-cmd --direct --add-rule ipv4 filter FORWARD 0 -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

For example, Configure that incoming packets come to 22 port of External zone are forwarded to another Host(192.168.0.31) of 22 port

firewall-cmd --zone=external --add-forward-port=port=22:proto=tcp:toport=22:toaddr=192.168.0.31

 

以上是关于centos7 firewall 一些用法的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7下Firewall防火墙配置用法详解

CentOS7的一些指令

CentOS 7.x 防火墙开放端口相关用法记录

Firewalld 用法解析

CentOS7中防火墙的一些常用配置

如何关闭centos7上的firewall