laitimes

On domestic operating systems, check the IP address by hostname | UnionTech | Kirin | Zhongke Fangde

author:Pengdasheng operation and maintenance

Original link: Check the IP address by hostname on the domestic operating system | UnionTech | Kirin | Zhongke Fangde

Hello, everyone! Today I bring you an article on finding an IP address by hostname on a domestic operating system. Finding an IP address by hostname is one of the common operations in network management and troubleshooting. This article will introduce in detail how to use command-line tools to find the IP address corresponding to the hostname on domestic operating systems (such as UnionTech UOS, Kylin KOS, and Zhongke Fangde). Welcome everyone to share and forward, click to follow and watch!

Why should I look up an IP address by hostname?

In network management, it is more convenient and manageable to use hostnames instead of IP addresses for communication. However, there are times when we need to know the IP address for the hostname, such as when troubleshooting, network configuration, or security audits.

Command-line tools used

In Linux, there are several command-line tools that can be used to find the IP address corresponding to the hostname, such as ping, nslookup, host, and dig. Here's a closer look at how to use these tools.

1. Check the system information

pdsyw@pdsyw-PC:~/Desktop$ cat /etc/os-version

[Version]

SystemName=UOS Desktop

SystemName[zh_CN]=统信桌面操作系统

ProductType=Desktop

ProductType[zh_CN]=桌面

EditionName=Professional

EditionName[zh_CN]=专业版

MajorVersion=20

MinorVersion=1070

OsBuild=11014.100.100

pdsyw@pdsyw-PC:~/Desktop$ uname -a

Linux pdsyw-PC 4.19.0-arm64-desktop #7020 SMP Wed Apr 17 11:27:22 CST 2024 aarch64 GNU/Linux

pdsyw@pdsyw-PC:~/Desktop$

On domestic operating systems, check the IP address by hostname | UnionTech | Kirin | Zhongke Fangde

2. Pass the nslookup command

pdsyw@pdsyw-PC:~/Desktop$ nslookup baidu.com

Server: 10.211.55.1

Address: 10.211.55.1#53

Non-authoritative answer:

Name: baidu.com

Address: 39.156.66.10

Name: baidu.com

Address: 110.242.68.66

pdsyw@pdsyw-PC:~/Desktop$

The content is explained as follows:

pdsyw@pdsyw-PC:~/Desktop$ nslookup baidu.com

nslookup baidu.com: Run the nslookup command to query the IP address of the domain name baidu.com.

Server: 10.211.55.1

Address: 10.211.55.1#53

Server: The IP address of the specified DNS server, in this case 10.211.55.1.

Address: Also the IP address of the DNS server with port number #53, which is the default port for the DNS service.

Non-authoritative answer:

Non-authoritative answer: Indicates that this is not an authoritative answer, and the results returned by the DNS server are from the cache or non-authoritative server, not directly from the authoritative DNS server of the domain name.

Name: baidu.com

Address: 39.156.66.10

Name: baidu.com

Address: 110.242.68.66

Name: baidu.com: 显示查询的域名。

Address: 39.156.66.10: baidu.com The first IP address after resolution.

Address: 110.242.68.66: baidu.com 解析后的第二个IP地址。

These IP addresses are one of the valid IP addresses for baidu.com domain names. Multiple IP addresses indicate that the domain has multiple servers to process requests for load balancing or redundancy.

On domestic operating systems, check the IP address by hostname | UnionTech | Kirin | Zhongke Fangde

3. Via the host command

pdsyw@pdsyw-PC:~/Desktop$ host baidu.com

baidu.com has address 110.242.68.66

baidu.com has address 39.156.66.10

baidu.com mail is handled by 20 usmx01.baidu.com.

baidu.com mail is handled by 15 mx.n.shifen.com.

baidu.com mail is handled by 20 jpmx.baidu.com.

baidu.com mail is handled by 10 mx.maillb.baidu.com.

baidu.com mail is handled by 20 mx1.baidu.com.

baidu.com mail is handled by 20 mx50.baidu.com.

pdsyw@pdsyw-PC:~/Desktop$

The content is explained as follows:

pdsyw@pdsyw-PC:~/Desktop$ host baidu.com

host baidu.com: Run the host command to query the IP address and mail server information of the domain name baidu.com.

baidu.com has address 110.242.68.66

baidu.com has address 39.156.66.10

baidu.com has address 110.242.68.66: Displays the first IP address after baidu.com resolution.

baidu.com has address 39.156.66.10: 显示 baidu.com 解析后的第二个IP地址。

baidu.com mail is handled by 20 usmx01.baidu.com.

baidu.com mail is handled by 15 mx.n.shifen.com.

baidu.com mail is handled by 20 jpmx.baidu.com.

baidu.com mail is handled by 10 mx.maillb.baidu.com.

baidu.com mail is handled by 20 mx1.baidu.com.

baidu.com mail is handled by 20 mx50.baidu.com.

baidu.com mail is handled by 20 usmx01.baidu.com.: Displays the mail exchange (MX) server usmx01.baidu.com that processes baidu.com mail, with priority 20.

baidu.com mail is handled by 15 mx.n.shifen.com.: Displays the mail exchange (MX) server mx.n.shifen.com that processes baidu.com mail, with a priority of 15.

baidu.com mail is handled by 20 jpmx.baidu.com.: Displays the mail exchange (MX) server jpmx.baidu.com that processes baidu.com mail, with a priority of 20.

baidu.com mail is handled by 10 mx.maillb.baidu.com.: Displays the mail exchange (MX) server mx.maillb.baidu.com that processes baidu.com mail, with a priority of 10.

baidu.com mail is handled by 20 mx1.baidu.com.: Displays the mail exchange (MX) server mx1.baidu.com that processes baidu.com mail, with a priority of 20.

baidu.com mail is handled by 20 mx50.baidu.com.: Displays the mail exchange (MX) server mx50.baidu.com that processes baidu.com mail, with a priority of 20.

These columns list the mail servers that are used to process mail from baidu.com domains, and their priority. A lower priority value indicates a higher priority for the server, and the mail server tries to connect in descending order of priority.

On domestic operating systems, check the IP address by hostname | UnionTech | Kirin | Zhongke Fangde

4. Pass the ping command

pdsyw@pdsyw-PC:~/Desktop$ ping -c 1 baidu.com

PING baidu.com (110.242.68.66) 56(84) bytes of data.

64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=128 time=131 ms

--- baidu.com ping statistics ---

1 packets transmitted, 1 received, 0% packet loss, time 0ms

rtt min/avg/max/mdev = 131.235/131.235/131.235/0.000 ms

pdsyw@pdsyw-PC:~/Desktop$

The content is explained as follows:

pdsyw@pdsyw-PC:~/Desktop$ ping -c 1 baidu.com

ping -c 1 baidu.com: Run the ping command and send an ICMP request packet to the baidu.com.

PING baidu.com (110.242.68.66) 56(84) bytes of data.

PING baidu.com (110.242.68.66): INDICATES THAT THE IP ADDRESS IS BEING PINGED baidu.com AND THE RESOLVED IP ADDRESS IS 110.242.68.66.

56(84) bytes of data: Specifies that the size of the ICMP request packet sent is 56 bytes (84 bytes in total plus the IP and ICMP headers).

64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=128 time=131 ms

64 bytes from 110.242.68.66 (110.242.68.66): 收到从IP地址 110.242.68.66 返回的64字节数据。

icmp_seq=1: The serial number of the ICMP packet is 1.

ttl=128: The TTL (time to live) value is 128, which indicates the maximum number of hops in the network.

time=131 ms: The round-trip time from send to receive to response is 131 ms.

--- baidu.com ping statistics ---

--- baidu.com ping statistics ---: 这是ping命令的统计信息部分。

1 packets transmitted, 1 received, 0% packet loss, time 0ms

1 packets transmitted: 发送了1个数据包。

1 received: 接收到1个数据包。

0% packet loss: 0% packet loss.

time 0ms: The total ping test time is 0 ms.

rtt min/avg/max/mdev = 131.235/131.235/131.235/0.000 ms

rtt min/avg/max/mdev: Min/Mean/Max/Standard deviation of round-trip time.

= 131.235/131.235/131.235/0.000 ms: Minimum, average, and maximum round-trip times are all 131.235 ms, with a standard deviation of 0.000 ms.

On domestic operating systems, check the IP address by hostname | UnionTech | Kirin | Zhongke Fangde

5. Pass the DIG command

pdsyw@pdsyw-PC:~/Desktop$ dig+short baidu.com

39.156.66.10

110.242.68.66

pdsyw@pdsyw-PC:~/Desktop$

The content is explained as follows:

pdsyw@pdsyw-PC:~/Desktop$ dig+short baidu.com

dig +short baidu.com: Run the dig command to query the IP address of the baidu.com, and use the +short option to simplify the output and only show the IP address.

39.156.66.10

110.242.68.66

39.156.66.10: baidu.com The first IP address resolved.

110.242.68.66: baidu.com The second IP address resolved.

These lines show a list of IP addresses for baidu.com.

On domestic operating systems, check the IP address by hostname | UnionTech | Kirin | Zhongke Fangde

Through the introduction of this article, you should have mastered the method of how to find IP address by hostname on domestic operating systems. This can be done quickly and easily using the ping, nslookup, host, and dig commands. In network management and troubleshooting, these tools can help you quickly obtain the network information you need to improve your productivity. If you find this article useful, please share and retweet. At the same time, don't forget to follow and watch, so that you can get more practical technical information and solutions in the future. Thank you all for reading and we'll see you next time!

Read on