首页 > 系统服务 > 详细

Linux firewall

时间:2018-04-24 17:05:37      阅读:321      评论:0      收藏:0      [点我收藏+]
  1. Cent Os

  • to list all firwalls  firwall-cmd --list-all

bsc@ubuntu:~$ 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

原文:https://www.cnblogs.com/anyu686/p/8931052.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!