首页 > 科技 > 卸载iptables这个骚操作差点丢了工作,知道怎么挽回嘛?

卸载iptables这个骚操作差点丢了工作,知道怎么挽回嘛?

CentOS 7 中执行:yum remove iptables 后,一般不会在意输出信息,不好意思,你错过了重点,输出信息中包含了如下一段内容: 这里提示我们不仅卸载了 iptables 服务,同时还卸载了15个软件包,这包含了网卡驱动、kexec内核组件软件包、iproute网络管理工具包、系统初始化软件包initscripts 等,我们会发现 ip、service等命令丢失了,重启服务器后网卡也没有了

Dependencies Resolved

===========================================================================================

Package Arch Version Repository Size

===========================================================================================

Removing:

iptables x86_64 1.4.21-18.0.1.el7.centos @anaconda 1.5 M

Removing for dependencies:

abrt-addon-vmcore x86_64 2.1.11-48.el7.centos @anaconda 41 k

abrt-cli x86_64 2.1.11-48.el7.centos @anaconda 0.0

abrt-console-notification x86_64 2.1.11-48.el7.centos @anaconda 1.3 k

dhclient x86_64 12:4.2.5-58.el7.centos @anaconda 472 k

dracut-network x86_64 033-502.el7 @anaconda 144 k

firewalld noarch 0.4.4.4-6.el7 @anaconda 1.8 M

initscripts x86_64 9.49.39-1.el7 @anaconda 1.4 M

iproute x86_64 3.10.0-87.el7 @anaconda 1.4 M

kbd x86_64 1.15.5-13.el7 @anaconda 1.3 M

kexec-tools x86_64 2.0.14-17.el7 @anaconda 739 k

libstoragemgmt x86_64 1.4.0-3.el7 @anaconda 639 k

libstoragemgmt-python noarch 1.4.0-3.el7 @anaconda 798 k

libstoragemgmt-python-clibs x86_64 1.4.0-3.el7 @anaconda 24 k

plymouth x86_64 0.8.9-0.28.20140113.el7.centos @anaconda 227 k

plymouth-scripts x86_64 0.8.9-0.28.20140113.el7.centos @anaconda 22 k

Transaction Summary

===========================================================================================

Remove 1 Package (+15 Dependent packages)


系统恢复正常方法: 1、VNC方式登陆服务器,先手动配置服务器网络:

  1. root@BJ-CentOS7 ~ # ifconfig eth0 内网ip netmask 子网掩码
  2. root@BJ-CentOS7 ~ # route add default gw 网关地址

2、服务器网络配置好之后,使用 yum install 方式将被卸载的安装包再安装回来,当然这时如果不需要 iptables 服务可以不用再安装iptables

root@BJ-CentOS7 ~ # yum -y install iptables abrt-addon-vmcore abrt-cli abrt-console-notification dhclient dracut-network firewalld initscripts iproute kbd kexec-tools libstoragemgmt libstoragemgmt-python libstoragemgmt-python-clibs plymouth plymouth-scripts



注意:

1、CentOS 7.x 中如果不需要使用 iptables 防火墙,可以清空策略条目,或者停止 iptables 服务 –#– 但是我们停止 iptables 服务时会提示没有服务,因为centos从7开始默认用的是firewalld,这个是基于iptables的,虽然有iptables的核心,但是 iptables 的服务(iptables-services)是没安装的。所以你只要停止firewalld服务即可

2、centos 7.x 中如果不小心卸载了 iptables 并附带卸载了其他软件包,都可以参考上述方法重新安装上误卸载的软件包使系统恢复正常


本文来自投稿,不代表本人立场,如若转载,请注明出处:http://www.souzhinan.com/kj/264142.html