Networking in Linux


How to resolve hostname to IP

Sometimes fancy DNS package and even ping command is not available and installation is not an option.

Use glibc tool:

getent hosts {hostname}

Other tools that are not always available:

host {hostname}
nslookup {hostname}
dig {hostname}
ping {hostname}

List IP address of the machine

ip addr