Support > About cybersecurity > Find the host IP for the live network connection in Linux
Find the host IP for the live network connection in Linux
Time : 2024-11-14 12:16:31
Edit : Jtti

Find the host IP for the live network connection in Linux

How to find all live host IP addresses for network connections in linux. The specific method is as follows!

You can use the 'netstat' command. The netstat command displays information about network connections, routing tables, and interface statistics. To find the list of IP addresses connected to the server over TCP and UDP, you can use the following command:

netstat -ntu

The above command lists all TCP and UDP network connections, and the fifth column is the external IP information. Use the 'grep' command to filter out TCP connections:

netstat -ntu | grep tcp

ss command (a modern alternative to netstat) :

ss -tnp | grep -E '(ESTAB|SYN-SENT|SYN-RECV)'

Use the 'Nmap' tool. 'Nmap' is an open source network scanning and security audit tool that discovers devices on a network. Install 'Nmap' :

sudo apt-get install nmap # on a Debian/Ubuntu based system

or

sudo yum install nmap # on RedHat based systems

'Nmap' scans a specific network to find all active host IP addresses:

nmap-sn Indicates the network address

If the network address is' 10.42.0.0/22 ', the command will be:

nmap-sn 10.42.0.0/22

The -sn parameter indicates that the ping scan is performed but the port scan is not performed.

Use 'curl' or 'wget' commands and external services:

Use the 'curl' or 'wget' command in conjunction with an external service to see the public IP address of the local unit. For example:

curl ifconfig.me

or

wget -qO- ifconfig.me

You can also get your public IP address from an external service.

The above method can help you find all the real-time host IP addresses of the network connection in the Linux system. Select an appropriate method according to the specific requirements.

Relevant contents

Ways to find account information and login details in Linux What Is the Impact of Disabling the DNS Client and How to Check whether the DNS Client is enabled Method of data encryption on the vps server Is it true that the OpenAI tool Whisper can hallucinate Understand the differences and connections between SSL and TLS
Go back

24/7/365 support.We work when you work

Support