Usually by modifying the configuration file to modify the way:
NIC configuration file location / etc / sysconfig / network-scripts / ifcfg-ens33
DNS configuration file /etc/resolv.conf location
Static hostname configuration file location / etc / hosts
Profiles order to take effect:
- hosts
- NIC configuration file / etc / sysconfig / network-scripts / ifcfg-ens33
- DNS configuration file resolv.conf
Configure a static ip
example:
vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static 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 UUID=10d6dd25-6383-480f-8c74-3cc4ca3dd78b DEVICE=ens33 ONBOOT=yes IPADDR=192.168.1.88 BROADCAST=192.168.1.255 "ifcfg-ens33" 19L, 370C
Example of the configuration parameters, see below
Parameter values are not case sensitive, single and double quotes, even without the quotes
- TYPE:Ethernet、IPsec
- DEVICE: Network Interface Name
- BOOTPROTO : boot protocol address
none: do not use the startup protocol address
BOOTP : Use BOOTP protocol
dhcp : dhcp Use Agreement
static : Static address protocol
- ONBOOT: whether to activate when the system starts
yes : activated
NO : not activated (this is the default value)
- IPADDR : IP address
- NETMASK : Subnet Mask
- GATEWAY : Gateway address
- BROADCAST : Broadcast address
- The HWADDR / the MACADDR: the MAC address, only a set, can not conflict with each other simultaneously provided
- PEERDNS : Specifies whether the DNS . If you eat DHCP protocol, the default is yes
yes : If the DNS settings, modify /etc/resolv.confg in DNS
NO : /etc/resolv.confg does not modify the DNS
- DNS1 / DNS2: When PEERDNS to yes when /etc/resolv.conf will be written in
- NM_CONTROLLED : whether by the Network Manager to control the network interface, the changes take effect immediately after saving, usually no recommendations
yes : by the Network Manager control
NO : Network Manager help control
- USERCTL : user access control
yes: non- root user to allow control of the network interface
no: non- root user is not allowed to control the network interface
- IPV6INIT : whether IPv6
yes : Support IPv6
NO : do not support IPv6
- IPV6ADDR : the IPv6 address / prefix length
If you need to access external networks through the domain name, you need to add dns, modify /etc/resolv.conf configuration reference
; generated by /usr/sbin/dhclient-script nameserver 202.101.172.35 nameserver 114.114.114.114 search localdomain
-
Address nameserver dns server
After configuration, you need to restart the network card