标签:table 禁用 直接 enable tcp status 关闭防火墙 etc 开机启动
centos6 : ifconfig
centos7 : ip addr
centos6 : 修改/etc/sysconfig/network
centos7 : 修改/etc/hostname,也可以直接使用命令 hostnamectl set-hostname yourhostname
centos6: vim /etc/sysconfig/network-scripts/ifcfg-eth0
centos7: vim /etc/sysconfig/network-scripts/ifcfg-ens33
centos6: service servicename start/stop/restart/status/reload
centos7: systemctl start/stop/restart/status/reload servicename
centos6:
1.永久有效
开启: chkconfig iptables on
关闭: chkconfig iptables off
2.即刻生效
开启: service iptables start
关闭: service iptables stop
3.开启部分端口
vim /etc/sysconfig/iptables
添加想要开启的相关端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8082 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables restart
centos7:
1 启动:systemctl start firewalld.service
2 关闭:systemctl stop firewalld.service
3 重启:systemctl restart firewalld.service
4 显示状态:systemctl status firewalld.service
5 在开机时启动:systemctl enable firewalld.service
6 永久禁用:systemctl disable firewalld.service
7 查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?
8 查看已启动的服务列表:systemctl list-unit-files|grep enabled
标签:table 禁用 直接 enable tcp status 关闭防火墙 etc 开机启动
原文地址:https://www.cnblogs.com/helloworld6379/p/13198416.html