In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Suse linux how to change the host name, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
I. description of the HOST file
1. About / etc/hosts
The / etc/hosts of Linux is the file that configures the ip address and its corresponding hostname, where the ip of the local or other host and its corresponding hostname are recorded. This configuration file may be different for different versions of linux. For example, the corresponding file for Debian is / etc/hostname.
two。 Configuration file
This file can configure the host ip and the corresponding hostname, which is important for server-type linux systems. On a local area network or INTERNET, each host has an IP address, which distinguishes each host and can communicate according to the ip. But the IP address is not easy to remember, so there is a domain name. Host names make it easy to access each other.
The configuration file for the Linux hostname is / etc/hosts;, which indicates which domain names of the host correspond to those ip and which ip correspond to those hostnames: usually, this file first records the local ip and hostname:
127.0.0.1 localhost.localdomain localhost
3. Description of configuration file format
Generally speaking, the content of / etc/hosts is similar to the following:
Format: network IP address + host name or domain name + host alias
127.0.0.1 localhost.localdomain localhost
Another format is also allowed.
Format: network IP address + hostname or domain name
192.168.1.2 XX
Problems that can be solved by 4./hosts files
4.1 slow remote login to linux host
The client logs in to a linux host remotely, but waits a long time to enter after entering the password. This is because the linux host needs to parse ip when returning information. If the client's ip address is added to the hosts file of the linux host in advance, it will be very fast to log in to linux remotely from the client.
Note: the remote login here is not only ssh, but also mysql remote login or file sharing query.
4.2 dual-computer interconnection
When two hosts are only connected to each other, both hosts need to set their own ip and add their own ip and hostname to each other's hosts file. For example, printer sharing across network segments can also be achieved by modifying hosts.
Second, what points should be set up
1. The hostname command can temporarily modify the machine name.
# hostname / / View the machine name
# hostname-I / / View the ip address corresponding to this machine name
# hostname XX / / modify the machine name to XX
2. Modify the configuration file to modify the machine name
# vi / etc/sysconfig/network / / modify HOSTNAME=XX (this is to be modified under REDHAT LINUX)
# vi / etc/hosts / / change the default machine name localhostlocalhost.localhost localhst to XX
# reboot / / restart the machine after modification
3. There are other modifications to be made under SUSE:
Method 1. Configure through yast2 management tools
Run the yast2 tool in console to modify the hostname (hostname)
# yast2 network or # yastnetwork
Select "Hostname/DNS" in Network Settings
Enter the hostname in the "Hostname" input box, enter the domain name in "Domain name", and accept the default "local" if there is no domain name.
Note: if you use DHCP, you need to cancel "Change Hostname via DHCP", otherwise assign the host name bogon (hypocritical person).
Method 2. Modify the hostname by modifying the configuration file and running the command
Modify the / etc/hosts file to save the hostname in this file, for example:
10.4.125.154 wcqm02.site wcqm02
Then run the command to set the hostname
# / etc/rc.d/boot.localnet start
Method 3. Run sysctl to change the hostname dynamically
# sysctl-w kernel.hostname=wcqm02
After reading the above, have you mastered how suse linux changes the host name? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.