linux6.8 重启防火墙,centos6.8和7.2的网络重启和防火墙的一些基本命令的不同

作为一个初学Linux的菜鸟,centos6.8和7.2的一些命令的区别,很是烦恼,因此在这和大家分享一些我掌握的一些基本命令,希望能和大家共同的学习,共同的进步。

网络重启

centos6.8

[root@localhost ~]# service network restart

Shutting down interface eth0:  Device state: 3 (disconnected)

[  OK  ]

Shutting down loopback interface:                          [  OK  ]

Bringing up loopback interface:                            [  OK  ]

Bringing up interface eth0:  Active connection state: activating

Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/4

state: activated

Connection activated

[  OK  ]

centos7.2

[root@localhost ~]# systemctl restart network

防火墙的一些基本命令

centos6.8

查看防火墙的状态

[root@localhost ~]# service iptables status

iptables: Firewall is not running.

开启防火墙

[root@localhost ~]# service iptables start

iptables: Applying firewall rules:                         [  OK  ]

关闭防火墙

[root@localhost ~]# service iptables stop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

centos7.2

查看防火墙的状态

[root@localhost ~]# systemctl status firewalld.service

● firewalld.service - firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)

Active: active (running) since Sun 2016-07-24 03:59:11 EDT; 22min ago

Main PID: 19402 (firewalld)

CGroup: /system.slice/firewalld.service

└─19402 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Hint: Some lines were ellipsized, use -l to show in full.

关闭防火墙

[root@localhost ~]# systemctl stop firewalld.service

[root@localhost ~]# systemctl status firewalld.service

● firewalld.service - firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)

Active: inactive (dead)

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 03:59:13 localhost.localdomain firewalld[19402]: 2016-07-24 03:59:13 ERROR: CO....

Jul 24 04:22:29 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewa....

Jul 24 04:22:30 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewal....

Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost ~]#

开启防火墙

[root@localhost ~]# systemctl start firewalld.service

[root@localhost ~]# systemctl status firewalld.service

● firewalld.service - firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)

Active: active (running) since Sun 2016-07-24 04:24:02 EDT; 3s ago

Main PID: 21355 (firewalld)

CGroup: /system.slice/firewalld.service

└─21355 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....

Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....

Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....

Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....

Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....

Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....

Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....

Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....

Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....

Jul 24 04:24:04 localhost.localdomain firewalld[21355]: 2016-07-24 04:24:04 ERROR: CO....

Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost ~]#

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值