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 > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to configure host name in linux", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to configure host name in linux".
1. Configure Linux hostname
Let's configure two centos7 virtual machines with hostnames of client and server with host IP addresses of 192.168.30.8 and 192.168.30.9, respectively.
Configure client host [root@client ~] # vi / etc/sysconfig/network
Add the following and save:
# Created by anacondaNETWORKING=yeshostname=client restart the network: [root@client ~] # systemctl restart network [root@client ~] # hostnameclient [root@client ~] #
If it does not work, you can use the following command:
[root@client ~] # hostnamectl set-hostname client configure server host [root@server ~] # hostnamectl set-hostname server
Restart the network:
[root@server] # systemctl restart network [root@server] # hostnameserver [root@server] # uname-nserver2. Configure hostname and IP Mappin
Configure hosts files for client and server
Vi / etc/hosts
Add the following:
192.168.30.8 client192.168.30.9 server3. test
Use ping hostname to test whether the configuration is successful:
Client ping server:
Time 2001msrtt min/avg/max/mdev = 0.384max 0.522max 0.616max 0.099ms [root@client] #
Server ping client:
[root@Server] # ping client-c 3PING client (192.168.30.8) 56 (84) bytes of data.64 bytes from client (192.168.30.8): icmp_seq=1 ttl=64 time=0.502 ms64 bytes from client (192.168.30.8): icmp_seq=2 ttl=64 time=0.678 ms64 bytes from client (192.168.30.8): icmp_seq=3 ttl=64 time=0.323 ms--- client ping statistics-3 packets transmitted, 3 received, 0 packet loss Time 2003msrtt min/avg/max/mdev = 0.323 / 0.501 / 0.678 / 0.144 ms [root@Server ~] #
After configuring the hostname and IP mapping, you can directly ping the hostname instead of the ping IP address.
4. Configure windows hosts
Configure windows hosts so that it can be accessed through the hostname under windows.
Edit the C:\ Windows\ System32\ drivers\ etc\ hosts file and add the following:
192.168.30.8 client192.168.30.9 server
Save
5. Windows Test C:\ Users\ 10287 > ping client-n 3 is Ping client [192.168.30.8] with 32 bytes of data: reply from 192.168.30.8: bytes = 32 time
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.