Configure Network & DNS & Hostname

1. Network card configuration file

/etc/sysconfig/network-scripts/ifcfg-ethxx

[yc@yc ~]$ cat /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE=Ethernet # device type

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=dhcp # Address allocation mode

DEFROUTE = yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE = yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=ens33 # NIC name

UUID=87d7c3d6-fc84-4531-ac96-0f7e8c3b378e

DEVICE=ens33

ONBOOT=yes # Whether to start

 

IPADDR=192.168.0.101 # IP address

NETMASK=255.255.255.0 # subnet mask

GATEWAY=192.168.0.1 # Gateway address

DNS1=114.114.114.114 # DNS address

DNS2=114.114.115.115 # DNS address

2. DNS configuration file

/etc/resolv.conf

Note: After ifcfg-xxx is changed, the DNS configuration in it will overwrite resolv.conf. If there is no DNS in ifcfg, the nameserver in resolv.conf will be cleared.

[yc@yc ~]$ cat /etc/resolv.conf

# Generated by NetworkManager

search rhce

nameserver 114.114.114.114

nameserver 114.114.115.115

3. Hostname file

/etc/sysconfig/network

Mainly for the NETWORKING=yes # here must not be no whether the network works

appendix

1.Linux-network configuration (IP gateway dns configuration) network management

https://blog.csdn.net/wang740209668/article/details/53373425

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325386386&siteId=291194637