There are several commands that can be used to check the network connection in Linux, some of the most commonly used ones are:
ping
: This is a basic command that sends an echo request to a specified domain or IP address. It is used to check if the host is reachable and to measure the round-trip time for packets to travel from the source to destination and back. For example:
ping google.com
traceroute
: This command is used to determine the route taken by packets from the source to the destination. It helps to identify intermediate routers or hops along the way and any potential bottlenecks or connectivity issues. For example:
traceroute google.com
nslookup
: This command is used to query DNS servers for information about a domain name or IP address. It is used to verify the DNS resolution and to obtain the IP address associated with a domain name. For example:
nslookup google.com
ifconfig
: This command is used to display the status of network interfaces and to configure network parameters. For example:
ifconfig
This will display the status of all network interfaces on the machine, including IP addresses, netmasks, and broadcast addresses.
ip addr
: This is a newer version of theifconfig
command that is used to display the status of network interfaces. For example:
ip addr
This will display the status of all network interfaces on the machine, including IP addresses, netmasks, and broadcast addresses.