VietcsysconfignetworkNETWORKING = yesHOSTNAME = yourname here modify hostnameNISDOMAIN = eng-cnplatformcom2 modify the name in etchosts # privileges # vi/etc/sysconfig/networking = yesHOSTNAME = yourname/here modify hostnameNISDOMAIN = eng-cn.platform.com 2. modify the name in/etc/hosts # vi/etc/hosts127.0.0.1 localhost. localdomain localhost172.17.33.169 yourname // modify hostname 3 here. finally, run the following command on the terminal: # hostname ***** // ***** to change the hostnameh. The ostname command only temporarily changes the host name. after restart, the host name is restored to the original one. To change the host name permanently, modify the/etc/sysconfig/network file. I found a problem today. due to my habits, I didn't set the LINUX host name when installing the system. Instead, I used to set it with # hostname (host name, when you log on to the system again, the set host name takes effect. because the server is on for a long time and does not restart much, you have never noticed that when you restart the host, the host name set using hostname is not recorded in the system file. View the host name command # uname -nqmail.hzhyzg.com configuration file # cat/etc/sysconfig/networkNETWORKING = yesHOSTNAME = localhost. localdomain changes the HOSTNAME to the configured host name, which will always take effect. in linux, modify the host name and modify the host name: 1. /etc/sysconfig/network content: networking = yeshostname = lh // host name (this line does not exist? Add this line.) gateway = 192.168.1.12. run the command: # hostname lh // lh is the host name 3. /etc/hosts content: # do not remove the following line, or various programs # that require network functionality will fail.127.0.0.1 localhost. localdomain localhost writes the second localhost as lh, that is, 127.0.0.1 lh localhost. localdomain localhost, but step 3 is not required. If all three steps are completed, the host name will be successfully modified in linux regardless of whether or not the host name is restarted. the default host name is loalhost. to modify the host name, run the following command: hostname xxx. However, if you are using the x window, you cannot open the xterm after modifying the host name using this command. Therefore, the thorough solution is to directly modify the/etc/network File: hostname = xxx, then restart the computer, and the host name has been modified. The system that uses dhcp cannot use the above method, because when the network is started, the host name will be changed to the name provided by the dhcp server. What should we do? Since the host name has been roughly modified, we have also roughly changed it back: edit/etc/rc, add a line of hostname xxx at the end, and restart the system .. Modify the IP address of the server: modify IP available netconfig or ifconfig eth0 192.168.1.1 255.255.255.0 # Do not save ip add dev eth0 192.168.1.1/24 # Do not save or vi/etc/sysconfig/network-scripts/ifcfg-eth0service network restart # restart the service
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