Linux network commands
Linux offers several powerful tools to manage network connections. They are often similar to the standard UNIX network commands.
We will list some of the most common here.
Open command line and type the command without quotes, and hit enter. Note that to make any changes you need to be logged in as the root user.
Display Current Config for all NIC's
Display Current Config for eth0
(eth0 is the first installed network card, eth1 is the second and so on)
'ifconfig eth0 *ip*' where *ip* should be replaced with desired IP address.
Assign multiple IP's
'ifconfig eth0:0 *ip*' where *ip* should be replaced with desired IP address.
Assign second IP
'ifconfig eth0:1 *ip*' where *ip* should be replaced with desired IP address.
Disable network card
'ifconfig eth0 down'
Enable network card
'ifconfig eth0 up'
'ifconfig eth0 *ip* netmask 255.255.255.0' where *ip* should be replaced with desired IP address.
Assign Default Gateway
'route add default gw 192.168.1.1'
'traceroute *url or host*'
'tracepath *url or host*'
Detailed DNS Test
Advanced Reverse Lookup
'dig -x *ip*'
Ping a host (to test connection)
'ping -c 3 *host or ip*'
View current routing table
'route' or 'route -n'
View arp cache
'arp' or 'arp -n'
Read similar articles