centos76网络/端口/防火墙常用命令

  1. 查看防火墙所有开放的端口
firewall-cmd --zone=public --list-ports
  1. 开放/关闭端口
firewall-cmd --zone=public --add-port=8888/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --remove-port=8888/tcp --permanent
firewall-cmd --reload
  1. 开启/关闭/重启/查看防火墙
systemctl start firewalld.service
systemctl stop firewalld.service
systemctl restart firewalld.service
systemctl status firewalld.service
  1. 开机自启/禁用防火墙
systemctl enable firewalld
systemctl disable firewalld
  1. 查看防火墙开关状态
firewall-cmd --state
  1. 检查端口(例如8888)被哪个进程占用
netstat -lnpt |grep 8888
  1. 查看某进程(例如1234)的详细信息
ps 1234
  1. 杀死/中止某进程(例如5678)
kill -9 5678
  1. centos6和centos7网卡/网络重启
service network restart
systemctl restart network
posted @ 2022-11-21 11:35  yub4by  阅读(22)  评论(0编辑  收藏  举报