Basic Linux Commands for Network Testing

This tutorial explains basic Linux commands used for testing and troubleshooting the network in detail with practical examples. Learn how to troubleshoot and test network step by step with ifconfig, ifup, ifdown, ping, arp, netsat, route, dhclient, system-config-network, service and chkconfig commands.


Every computer in network requires an IP address. With ifconifg command you can easily check the current configuration of active network adapters.



Default ifconfig command would display the current state of all active network adapters. To display the current configuration of a specific adapter use its number with ifconfig command. For example to display the current configuration of first adaptor only run following command

#ifconfig eth0

ifconfig eth0

During the exam if you think ifconfig command is missing any network adaptor, use -a option to list the configuration of all network adaptors, whether or not they are currently active.

#ifconfig -a

Other use of ifconfig command

How to assign IP address from ifconfig command

ifconfig command can also be used to assign the IP address. For example to assign IP address and subnet mask to eth0 adapter run following command

#ifconfig eth0 netmask

ifconfig netmask

How to activate or deactivate network adapter from ifconfig command

With ifconfig command you can also activate or deactivate the network adaptor. To deactivate network adaptor run following command

#ifconfig [network adaptor] down

ifconfig eth down

To activate the network adaptor run following command

#ifconfig [network adaptor] up

ifconfig eth up

During the exam use ifconfig command to list the current configuration of network adaptors only. There are better tools available for above tasks. To assign IP address use system-config-network. To activate or deactivate network adapter use ifup and ifdown commands.



ifdown command is used to deactivate the network adaptor. syntax of ifdown is following

#ifdown [network adaptor]



ifup command is used to activate the network adaptor. syntax of ifup is following

#ifup [network adaptor]



ping command is used to test the connectivity. ping command on linux works continuously. We need to press CTRL+C to stop it. If you are connected with internet, you can also check the connectivity with website. For example to test connectivity with our site run following command



During the exam you will not have internet access. ping command works on local network as well. Whenever you have trouble in connecting with network, use ping command in following order.

  • ping with localhost
  • ping with self IP address
  • ping with default gateway IP address
  • ping with remote computer IP

ping order


Address resolution protocol (ARP) bind MAC address with IP address. APR protocol works only in local network as MAC address are not routable. ARP table keep entries of local network systems. It is helpful to detect duplicate address on the network.


  • The Address column lists detected IP addresses on the network.
  • The HWtype column shows the hardware type of the adapter.
  • The HWaddress column shows the hardware address of the adapter.

netsat -r and route -n

netstat command with -r option is equivalent to the route command with -n option. Both will display the routing table.


Routing table can be very helpful during the exam to detect misconfigured gateway.


dhclient command fetch IP configuration for calling network card. For example following command will fetch IP configuration for eth0 network card from DHCP server.


#dhclient eth0

How to assign IP address in Linux

ifconfig command can be used to assign the IP address but as I said above during the exam we should use best available command. Use system-config-network command to assign IP address.


system config network

How to restart network service

Whenever you made change in IP configuration, you have to restart the network service so change can be applied. To restart network service run following command

#service network restart

How to start network service

During the exam you may get a system with network service disabled. To check network service run following command.

chkconfig list

if network service is off, run following command to on it.

chkconfig on


ComputerNetworkingNotes RHCE 7 Study Guide Basic Linux Commands for Network Testing