function::ip_ntop - Linux


ip_ntop is a command-line utility that converts an IP address from its binary representation to a human-readable string. It is primarily used for debugging and troubleshooting network-related issues.


ip_ntop [-46] [--inet4 | --inet6] <binary_ip_address>


| Option | Description |
| -4, --inet4 | Specifies that the input IP address is in IPv4 format. |
| -6, --inet6 | Specifies that the input IP address is in IPv6 format. (Default) |


Convert an IPv4 address:

# Output:

Convert an IPv6 address:

ip_ntop 2001:db8::85a3:08d3:ac1f
# Output: 2001:db8::85a3:08d3:ac1f

Common Issues

  • Incorrect IP address format: Ensure the input IP address is correctly formatted and matches the specified protocol version (-4 or -6).
  • Invalid binary representation: The input binary representation should be a valid IP address in the specified protocol version.


ip_ntop can be combined with other tools for network diagnostics, such as tcpdump or netstat. For example, to capture and display the IP addresses of incoming packets:

tcpdump -n -v | awk '{print ip_ntop($3)}'

Related Commands

  • ipcalc: Calculates IP address information, including IP range, subnet mask, and broadcast address.
  • nslookup: Looks up IP addresses from domain names or vice versa.
  • IP Address Calculator: Online tool for IP address manipulation and conversion.