当配置systemctl restart nfs-server.service时,不能正确重启服务该怎么办?
来源:互联网 发布:淘宝静物摄影布光技巧 编辑:程序博客网 时间:2024/05/20 03:06
首先systemctl restart nfs-server.service这个命领是centOS7最新命令,老版本的可能派不上用场了:#/etc/init.d/iptables restart
然后再看看为什么重启服务等命令无效,以下是流程,按照流程操作:
[root@lt ~]# service iptables status
防火墙已停
[root@lt ~]# service iptables start
[root@lt ~]# service iptables status
防火墙已停
解决方法:
一、初始化iptables。
iptables -F
service iptables save
service iptables restart
vi /etc/sysconfig/iptables
二、把预置的iptables规则添加进去就可以了:
# Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
以上都是配置,假如service iptables save时,报The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload , status). For other actions, please try to use systemctl.又要怎么办?原意是:服务命令只支持基本的LSB操作,请尝试使用systemctl。
最后再看看这份从网上找到来的贴子,能找到这些良心贴,真的是解决了我一大祸患,谢谢各位的贡献,以下我贴出另一份贴子的解决方式:
# service iptables saveThe service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
With RHEL 7 / CentOS 7, firewalld was introduced to manage iptables. IMHO, firewalld is more suited for workstations than for server environments.
It is possible to go back to a more classic iptables setup. First, stop and mask the firewalld service:
systemctl stop firewalldsystemctl mask firewalld
Then, install the iptables-services package:
yum install iptables-services
Enable the service at boot-time:
systemctl enable iptables
Managing the service
systemctl [stop|start|restart] iptables
Saving your firewall rules can be done as follows:
service iptables save
or
/usr/libexec/iptables/iptables.init save
- 当配置systemctl restart nfs-server.service时,不能正确重启服务该怎么办?
- 配置linux6网卡service nerwork restart 时出现重启失败及解决办法
- nfs-kernel-server restart
- Redirecting to /bin/systemctl restart sshd.service
- Redirecting to /bin/systemctl restart sshd.service
- 安装和启动tftp-server服务器及可能出现Redirecting to /bin/systemctl restart xinetd.service问题的解决方式
- 当汇错款时该怎么办?
- 当汇错款时该怎么办?
- ubuntu重启nfs服务
- ubuntu下用service httpd restart重启apache
- ubuntu下用service httpd restart重启apache
- ubuntu下用service httpd restart重启apache .
- Linux service network restart重启网络失败
- 重启防火墙(iptables)命令#service iptable restart失效
- 容器中使用systemctl命令重启服务
- Ubuntu server 下配置 NFS 服务
- redhat server上配置NFS服务
- 当某个 Exchange 存储无法装入时该怎么办
- ES7与ES8特性
- 成为一个软件测试工程师,你需要知道
- 操作系统第九章作业paging-multileveltranslate
- js中对象的复制,浅复制(浅拷贝)和深复制(深拷贝)
- 《JAVA编程技巧1001条》第335条:数学函数 SQRT.
- 当配置systemctl restart nfs-server.service时,不能正确重启服务该怎么办?
- 为什么要用工厂方法模式
- 言论丨李开复:中国在AI领域的优势与机会,现阶段AI领域的挑战
- 求助大神,这个代码该怎么写
- Python得到当前时间
- Effective Java -- 重写equals方法的通用约定(一)
- java8 stream理解与应用(1)
- 蜥蜴和地下室 51Nod
- CMD_ren结合excel批量重命名