linux下内部防火墙,Linux系统管理初步(五)Linux系统的防火墙-firewalld 编辑中

一、firewalld中的9个zone

firewalld中有9个zone,各个zone的说明如下

drop

Any incoming network packets are dropped; there is no reply. Only outgoing network connections are possible.

block

Any incoming network connections are rejected with an icmp-host-prohibited message for IPv4 and icmp6-adm-prohibited for IPv6. Only network connections initiated from within the system are possible.

public

For use in public areas. You do not trust the other computers on the network to not harm your computer. Only selected incoming connections are accepted.

external

For use on external networks with masquerading enabled, especially for routers. You do not trust the other computers on the network to not harm your computer. Only selected incoming connections are accepted.

dmz

For computers in your demilitarized zone that are publicly-accessible with limited access to your internal network. Only selected incoming connections are accepted.

work

For use in work areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

home

For use in home areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

internal

For use on internal networks. You mostly trust the other computers on the networks to not harm your computer. Only selected incoming connections are accepted.

trusted

All network connections are accepted.

译文:

由firewalld 提供的区域按照从不信任到信任的顺序排序。

丢弃 drop

任何流入网络的包都被丢弃,不作出任何响应。只允许流出的网络连接。

阻塞 block

任何进入的网络连接都被拒绝,并返回 IPv4 的 icmp-host-prohibited 报文或者 IPv6 的 icmp6-adm-prohibited 报文。只允许由该系统初始化的网络连接。

公开 public

用以可以公开的部分。你认为网络中其他的计算机不可信并且可能伤害你的计算机。只允许选中的连接接入。

外部 external

用在路由器等启用伪装的外部网络。你认为网络中其他的计算机不可信并且可能伤害你的计算机。只允许选中的连接接入。

隔离区dmz

用以允许隔离区(dmz)中的电脑有限地被外界网络访问。只接受被选中的连接。

工作 work

用在工作网络。你信任网络中的大多数计算机不会影响你的计算机。只接受被选中的连接。

家庭 home

用在家庭网络。你信任网络中的大多数计算机不会影响你的计算机。只接受被选中的连接。

内部 internal

用在内部网络。你信任网络中的大多数计算机不会影响你的计算机。只接受被选中的连接。

受信任的 trusted

允许所有网络连接。

二、firewalld的应用

操作前,我们看下当前系统中应用的是哪种防火墙程序。

systemctl list-units --all --type=service |egrep ‘firewalld|ip6tables|iptables‘

0de02c64f9114740d020e70d4659c6c0.png

看active那一列,active的就是在用的程序,如果你看到firewalld那一行是inactive的,那我们就用下列命令把他启动

systemctl start firewalld #

systemctl enable firewalld #

如果iptables.service是active的那我们也要把他停用

systemctl stop iptables

systemctl disable iptables

都执行完后可以再重复第一条命令看下服务状态是否跟截图一致。

firewall命令有点像一个英语句子,好理解,但是输入有点烦

比如说

firewall-cmd --get-default-zone

firewall-cmd --set-default-zone=work

firewall-cmd --get-zone-interface=ens33

命令行操作

(一)操作网卡与zone的关系

1、查看新加接口默认的zone

firewall-cmd --get-default-zone

9b710e38ca1322e104d0114613b4032c.png

2、设定新接口加入时的默认zone

firewall-cmd --set-default-zone=work

c02c81ea2c63d10f838d8cffcb3bf775.png

3、查看接口所在的zone

firewall-cmd --get-zone-of-interface=ens33

6bbd43baf18962e8bdf8f27c7bc1abe5.png

4、给指定的网卡设置zone

firewall-cmd --zone=dmz --d-interface=ens33

80141ba1b7e7e4ed62af7793689105eb.png

5、更改某个网卡的zone

firewall-cmd --zone=public --change-interface=ens33

aa9e29b9ea935a6640cccd2298858a31.png

6、查看系统所有网卡所在的zone

firewall-cmd --get-active-zones

8513c600814a02eae5d0638a5ab69c30.png

(二)操作zone的service

原文:http://blog.51cto.com/11934539/2065873

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值