码迷,mamicode.com
首页 > 系统相关 > 详细

Linux firewall

时间:2018-04-24 17:48:32      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:lis   efault   hang   define   ESS   amp   without   host   perm   

  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

标签:lis   efault   hang   define   ESS   amp   without   host   perm   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!