歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

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 ~]#

Copyright © Linux教程網 All Rights Reserved