IPTABLES报错问题-restorecon

IPTABLES报错问题

问题

场景:在公司AlmaLinux release 8.6 (Sky Tiger)环境下试图用iptables放行VPN端口的时候发现报错,无法正常运行,连保存iptbales写入指令也不行。
1、iptables:restorecon: command not found无法保存策略
2、iptables重启失败
复现问题: 
service iptables save
无法保存的错误提示:
iptables: Saving firewall rules to /etc/sysconfig/iptables: /etc/init.d/iptables: line 268: restorecon: command not found

排错、解决方式

1、查询restorecon命令.:
	which restorecon
	whereis restorecon
2、没结果,查询过滤系统相关二进制程序文件:
	ll /sbin/ | grep restore
3、无相关的文件,大概是包没装
	查找相关包:
		1、yum search restorecon
		2、yum provides restorecon //通过这个方式找到了相关包名:
		"policycoreutils-2.9-20.el8.x86_64 : SELinux policy core utilities" //缺失了这个包会导致iptables策略保存失败且会导致iptables服务启动失败。
打包:yum -y install policycoreutils
打包后查询系统生成的二进制程序文件:(多出以下三条)
	# ll /sbin/ | greprestore
		lrwxrwxrwx  1 root root       8 Oct  8 17:14 restorecon -> setfiles
		-rwxr-xr-x  1 root root   25416 Oct  8 17:14 restorecond
		-rwxr-xr-x  1 root root   16800 Oct  8 17:14 restorecon_xattr

验证

保存iptables策略:(成功)
[root@appliance ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
重启iptbales (成功)
[root@appliance ~]# systemctl restart iptables

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值