Modify hostname, ip, netmask, gateway, and dns in centos
Source: Internet
Author: User
Modify the hostname, ip, netmask, gateway, dns1, and hostname configuration file in centos:/etc/sysconfig/networkHOSTNAMEtank # Modify the host name NETWORKINGyes2 and the ip/netmask/gateway configuration file: /etc/sysconfig/networ
Modify the hostname, ip, netmask, gateway, and dns in centos. 1. modify the hostname configuration file: /etc/sysconfig/network HOSTNAME = tank # Modify the host name NETWORKING = yes 2. modify the ip/netmask/gateway configuration file: /etc/sysconfig/network-scripts/ifcfg-eth0 www.2cto.com DEVICE = eth0 # describe the DEVICE alias corresponding to the NIC, for example, in the ifcfg-eth0 file it is eth0BOOTPROTO = static # set the way the Nic gets the IP address, the possible options are static, dhcp, or bootp, which correspond to the IP addresses specified by the static state and obtained through the dhcp protocol, IP address BROADCAST = 192.168.0.255 # corresponding subnet BROADCAST address HWADDR = 00: 07: E9: 05: E8: b4 # The physical IP address of the corresponding Nic, IPADDR = 12.168.1.2 # if the IP address obtained by The NIC is set to static, this field specifies the IP address www.2cto.com IPV6INIT = no00006_autoconf = noNETMASK = 255.255.255.0 # NETWORK mask NETWORK = 192.168.1.0 # NETWORK address ONBOOT = yes # whether the system starts set this network interface, when set to yes, the system activates the device at startup. 3. modify the dns configuration file:/etc/resolv. conf nameserver 8.8.8.8 # google domain name server nameserver 8.8.4.4 # google domain name server restart network configuration: # service network restart or #/etc/init. d/network restart modify IP address effective immediately: # ifconfig eth0 192.168.0.2 netmask 255.255.255.0 effective start: www.2cto.com modify/etc/sysconfig/network-scripts/ifcfg-eth0 modify Gateway Default Gateway effective immediately: www.2cto.com # route add default gw 192.168.0.1 dev eth0 start effective: modify/etc/sysconfig/network modify DNS modify/etc/resolv. after the conf file is modified, it takes effect immediately. the host name modification also takes effect immediately after it is started. after it is restarted, it becomes invalid: # hostname centos1 start (restart the computer) takes effect: modify/etc/sysconfig/network
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