CentOS常用命令

service httpd restart
netstat -nt


firewall-config

/sbin/iptables -I INPUT -p tcp –dport 80 -j ACCEPT 

/sbin/iptables -I INPUT -p tcp –dport 8002 -j ACCEPT
/sbin/iptables -I INPUT -p tcp –dport 22 -j ACCEPT 

/sbin/iptables -I INPUT -p tcp –dport 8080 -j ACCEPT

firewall-cmd --state

# systemctl start firewalld # 启动,
# systemctl enable firewalld # 开机启动
# systemctl stop firewalld # 关闭
# systemctl disable firewalld # 取消开机启动


firewall-cmd --zone=dmz --add-port=8080/tcp

firewall-cmd --zone=dmz --add-port=80/tcp --permanent
firewall-cmd --zone=dmz --add-port=8002/tcp

允许某范围的 udp 端口至 public 级别,并永久生效
# firewall-cmd --zome=public --add-port=5060-5059/udp --permanent


um install iptables-services
systemctl mask firewalld.service
systemctl enable iptables.service
systemctl enable ip6tables.service
静态防火墙规则配置文件是 /etc/sysconfig/iptables 以及 /etc/sysconfig/ip6tables .
注: iptables 与 iptables-services 软件包不提供与服务配套使用的防火墙规则. 这些服务是用来保障兼容性以及供想使用自己防火墙规则的人使用的. 你可以安装并使用 system-config-firewall 来创建上述服务需要的规则. 为了能使用 system-config-firewall, 你必须停止 firewalld.
为服务创建规则并停用 firewalld 后,就可以启用 iptables 与 ip6tables 服务了:
systemctl stop firewalld.service
systemctl start iptables.service
systemctl start ip6tables.service

chkconfig --list

chkconfig httpd on

chkconfig network on

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值