1.2 NIC configuration file
DEVICE Nic Name (first block eth0, second block eth1 ...). And so on
HWADDR Network card MAC address
UUID Unique identifier, disk identity-------Blkid (view)
Onboot Restart the network card or server after the control card is not self-starting
How to get IP address when Bootproto network card is started (none manually specified IP)
Static statics
Automatic DHCP acquisition
IPADDR IP Address
NETMASK subnet mask to control the maximum number of machines in the LAN
1.2.1 Configuring DNS
/etc/resolv.conf
Used primarily to configure DNS settings
DNS Domain Name Resolution Service
URL, domain name www.baidu.com actual network use IP
Domain name, url--the corresponding IP address
DNS is the domain name and IP parsing tool
Gateway Gateways
Attention:
Nic configuration file takes precedence over etc/resolv.conf
1.2.2 Modifying the configuration DNS of the NIC
Cat>>/etc/sysconfig/network-scripts/ifcfg-eth0<<eof
dns1=223.5.5.5
dns2=223.6.6.6
Eof
1.2.3 Let the modified configuration take effect--restart the NIC
Turn off the network card and then turn on the NIC
Ifdown eth0 && ifup eth0
1.2.4 Restart all network cards
/etc/init.d/network restart
1.2.5 Check Results
Cat/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
Hwaddr=00:0c:29:aa:0b:e9
Type=ethernet
Uuid=f7515424-a426-4e24-852a-8abc4cfc07f8
Onboot=yes
Nm_controlled=yes
Bootproto=none
ipaddr=10.0.0.200
netmask=255.255.255.0
gateway=10.0.0.2
Userctl=no
Peerdns=yes
Ipv6init=no
dns1=223.5.5.5
dns2=223.6.6.6
cat/etc/resolv.conf
NameServer 223.5.5.5
NameServer 223.6.6.6
1.3 Modifying host Names
1.3.1 Temporarily Modify host name-View host name
Hostname
Modify the hostname file under/etc/sysconfig/network Linux
1.3.2 Modifying a host name temporarily---
Hostname OLDBOYEDU-39-NB
Hostname
Oldboyedu-39-niubility
1.3.3 Check if host name changed
Re-Login
Connecting to 10.0.0.200:22
...
Connection established.
To escape to local shell, press ' ctrl+alt+] '.
Last Login:sat Jul 06:58:39 from 10.0.0.1
1.3.4 permanently modifies host name--takes effect after restarting the server
cat/etc/sysconfig/network (view host name)
Networking=yes
Hostname=oldboyedu-39
Sed ' s#oldboyedu-39#oldboyedu-39-nb#g '/etc/sysconfig/network (permanently modified)
Networking=yes
Hostname=oldboyedu-39-nb
Sed-i ' S#oldboyedu-39#oldboyedu-39-nb#g '/etc/sysconfig/network
Cat/etc/sysconfig/network
Networking=yes
Hostname=oldboyedu-39-nb
Modify host name to take effect temporarily: the host name that was temporarily modified after restarting the server is invalidated.
Takes effect after restarting the server permanently
Permission denied denied access
This article is from the "Heyong" blog, make sure to keep this source http://heyong.blog.51cto.com/13121269/1954907
Network adapter configuration file and modify host name in Linux