Get the App
SLTechnology News&Howtos  ›  Servers  › 

Centos Network Card restart / Firewall / selinux/hosts-

Shulou Source: shulou.com Published: 2022-06-03 09:35:57 12月06日 Update

1. Restart the centos6 Nic: service network restart

Restart the centos7 network card: systemctl restart network

[root@centos7 ~] # systemctl restart network

Nic profile:

[root@centos7 network-scripts] # cat-n ifcfg-ens33

[root@centos7 network-scripts] # pwd

/ etc/sysconfig/network-scripts

1 TYPE=Ethernet

2 PROXY_METHOD=none

3 BROWSER_ONLY=no

4 BOOTPROTO=dhcp

5 DEFROUTE=yes

6 IPV4_FAILURE_FATAL=no

7 IPV6INIT=yes

8 IPV6_AUTOCONF=yes

9 IPV6_DEFROUTE=yes

10 IPV6_FAILURE_FATAL=no

11 IPV6_ADDR_GEN_MODE=stable-privacy

12 NAME=ens33

13 UUID=8bfc7f02-2ae1-42e2-8c97-a0bc98135071

14 DEVICE=ens33

15 ONBOOT=yes

Nic profile:

Device type: TYPE=Ethernet

Address assignment mode: BOOTPROTO=static

Nic name: NAME=ens33

Whether to start: ONBOOT=yes

IP address: IPADDR=192.168.30.102

Subnet mask: NETMASK=255.255.255.0

Gateway address: GATEWAY=192.168.30.1

DNS address: DNS1=192.168.30.1

2. DNS configuration file: cat / etc/resolv.conf

Host and IP binding: cat / etc/hosts

Hostname: cat / etc/hostname

3. Turn off the firewall and set the boot not to start

Centos 7

View firewall status: systemctl status firewalld

Turn off: systemctl stop firewalld

Enable: systemctl start firewalld

Power on and automatically shut down: systemctl disable firewalld

Boot auto start: systemctl enable firewalld

Centos6

Turn off the firewall

Chkconfig iptables off

Turn on the firewall

Chkconifg iptables on

Check whether the boot is enabled: chkconfig-- list | grep network (centos 6)

Chkconfig iptables-list

4. Temporarily and permanently close Selinux

Temporary shutdown:

Getenforce

[root@centos7 ~] # getenforce

Enforcing

Setenforce 0

[root@centos7 ~] # setenforce

Usage: setenforce [Enforcing | Permissive | 1 | 0]

Setenforce:SELinux is disabled

Modify the configuration file:

Vim / etc/selinux/config

Tags: Network card firewall fire protection address file configuration host name mode status type gateway device subnet permanent assignment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Tech Info OPPO Reno Linux Apple