首页 > 系统相关 >centos7 防火墙端口开启和关闭及查看

centos7 防火墙端口开启和关闭及查看

时间:2023-08-14 10:35:35浏览次数:33  
标签:service -- 端口 防火墙 firewalld centos7 systemctl

一、防火墙的开启、关闭、禁用命令

(1)设置开机启用防火墙:systemctl enable firewalld.service

(2)设置开机禁用防火墙:systemctl disable firewalld.service

(3)启动防火墙:systemctl start firewalld

(4)关闭防火墙:systemctl stop firewalld

(5)检查防火墙状态:systemctl status firewalld

二、配置防火墙端口

防火墙开启某端口:

firewall-cmd --zone=public --add-port=8888/tcp --permanent

防火墙关闭某端口:

firewall-cmd --zone=public --remove-port=8888/tcp --permanent

防火墙查看某个端口状态:

firewall-cmd --query-port=8888/tcp

查看已经开放的端口:

firewall-cmd --list-ports 

重启防火墙:

firewall-cmd --reload

关闭防火墙:

systemctl stop firewalld.service

开启防火墙:

systemctl start firewalld.service

设置开机自启

systemctl enable firewalld.service

设置开启不自启

systemctl disable firewalld.service

标签:service,--,端口,防火墙,firewalld,centos7,systemctl
From: https://www.cnblogs.com/haoyul/p/17627960.html

相关文章

  • centos7防火墙的简单使用
    环境centos7.9使用方法开启一个端口firewall-cmd--zone=public--add-port=514/tcp--permanentreload防火墙配置firewall-cmd--reload关闭一个防火墙端口firewall-cmd--zone=public--remove-port=514/tcp--permanent查看已开的端口配置firewall-cmd--l......
  • 推荐IP端口扫描工具
    以前用的是小小的portscan 老是报病毒实在不得其法,最近公司又扫描黑灰产,查着不让用。AngryIPScanner-Screenshots推荐这个吧,至少我在自己电脑,windows11不报毒了。AngryIPScanner-DownloadforWindows,MacorLinux还垮平台 Stand-aloneexecutable,免安装版。......
  • centos7忘记密码处理办法
    此界面按e进入grub编辑界面进入grub编辑界面。把linux16这行的ro修改为rwinit=/sysroot/bin/sh。按ctrl+x进入单用户模式登陆进去后,输入如下命令:chroot/sysroot/#切换到原系统LANG=en#设置显示语言passwdroot#修改root密码touch/.autorelabel#如果之前系......
  • 修改ssh端口号
    Linux修改远程连接端口参考博客:Linux修改远程连接端口【解决方法】错误:无法和SFTP服务器建立FTP连接,请选择合适的协议修改远程连接端口1.编辑sshd配置,修改默认的端口。vi/etc/ssh/sshd_config找到配置端口号的位置,可在命令行模式下输入'?#Port22'进行查找。详细命令可......
  • centos7安装python3.9
    Centos默认安装的是python2.7版本,需要使用python3,安装过程记录如下:查看系统python2的位置:whereispython安装编译python3的相关系统依赖包yum-yinstallzlib-develbzip2-developenssl-develncurses-develsqlite-develreadline-develtk-develzlibgccmake安装pip......
  • linux中常用端口查询命令
    1、lsof-i:80 用于查看某一端口的占用情况2、netstat-tunlp|grep80 用于查看指定的端口号的进程情况......
  • 问题记录 <git push 到 github 时遇到 ssh 端口问题>
    问题描述gitpush时遇到如下问题:ssh:connecttohostgithub.comport22:Connectiontimedoutfatal:Couldnotreadfromremoterepository.解决方式通过修改端口得以解决,将22端口改为443,添加~/.ssh/config内容如下:Hostgithub.comHostnamessh.github.com......
  • CentOS7.*基础网络配置
    基础网络配置Ip地址: 唯一表示网络中主机地址的标识,由.隔开的四组十进制数组成每一组数不超过255子网掩码:用来确定IP的网络地址网关:访问其它网段时需要通过的设备IP地址,不同网段通讯需要经过路由器转发出去(网关)Dns服务器:进行域名与ip解析的服务器查看所有网络接口的信息ifconf......
  • 改变端口号shell脚本
    1#开启端口2functionstartProxy(){3exporthttps_proxy=https://127.0.0.1:7890;4exporthttp_proxy=http://127.0.0.1:7890;5exportall_proxy=socks5://127.0.0.1:7890;6}7#获取端口8functiongetProxy(){9echohttp_proxy:$http_proxy......
  • Docker容器数据卷和端口映射
    拓扑图:推荐步骤:使用基础Centos:v1.0镜像生成容器名字apache,进入容器中安装阿里云源,安装apache服务,将容器导出到文件,将文件导入到docker中作为apache基础镜像使用,镜像名字apache:v1.0在Centos01主机创建/www/目录,将www.名字字母.com输入到/www/index.html中,使用apache镜像运行容器名......