Linux firewall
Posted anyu686
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux firewall相关的知识,希望对你有一定的参考价值。
-
Cent Os
- to list all firwalls firwall-cmd --list-all
[email protected]:~$ firewall-cmd --list-all
public (default, active)
interfaces: eth0
sources:
services: dhcpv6-client ssh
ports: 4000-4005/tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
- Add port :
firewall-cmd --add-port 4000-4005/tcp (--permernant) //without permernant, it apply to run time only, with permernat, it will still vaild after reboot
- Add service
firewall-cmd --add-service <service-name> (--permernant) // the service name can be get by firewall-cmd --get-services , and each service is defined in /usr/lib/firewalld/service/
2 Ubuntu uncompleted firewall
- check/change status: ufw status, ufw disbale/enable
- add service: ufw allow ssh :
-
ufw allow 53
This rule will allow tcp and udp port 53 to any address on this host.
To specify a protocol, append ‘/protocol‘ to the port. For example:ufw allow 25/tcp
-
This will deny all traffic to tcp port 80 on this host. Another exam‐
ple:ufw deny proto tcp from 10.0.0.0/8 to 192.168.0.1 port 25
以上是关于Linux firewall的主要内容,如果未能解决你的问题,请参考以下文章
Linux汇总一——Linux程序管理,Linux终端,Linux命令格式命令类型及Linux命令帮助
Linux 内核Linux 内核源码结构 ( 下载 Linux 内核源码 | 使用 VSCode 阅读 Linux 内核源码 )