Modify host name and network information in CentOS
Source: Internet
Author: User
1. modify the host name [root @ centos ~] # Vim/etc/sysconfig/network open the file, modify the following content and save NETWORKING = yes # use network HOSTNAME = centos # Set host name [root @ centos ~] # Hostname 1. modify host name
[Root @ centos ~] # Vim/etc/sysconfig/network
Open the file, modify the following content, and save
NETWORKING = yes # use the network
HOSTNAME = centos # Set host name
Open the file, modify the following content, and save
DEVICE = eth0 # corresponds to the first Nic
TYPE = Ethernet
ONBOOT = yes # run at startup
NM_CONTROLLED = yes
BOOTPROTO = static # use a static IP address instead of an IP address allocated by DHCP
DEFROUTE = yes
20174_failure_fatal = yes
IPV6INIT = no
NAME = "System eth0" # NAME
HWADDR = 00: 50: 56: 94: 04: 3C # it must correspond to the MAC address of etho (/etc/udev/rules. d/70-persistent-net.rules)
PEERDNS = yes
PEERROUTES = yes
IPADDR = 192.168.1.128 # specify the local IP address
NETMASK = 255.255.255.0 # specify the subnet mask
GATEWAY = 192.168.1.2 # specify the GATEWAY
DNS1 = 192.168.1.2
3. modify DNS [root @ centos ~] # Vim/etc/resolv. conf
Open the file, modify the following content, and save
Nameserver 8.8.8.8 # GOOGLE's DNS server
Nameserver 192.168.1.2 # specify the DNS server specified on the router
4. restart the network configuration [root @ centos ~] # Service network restart
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service