Linux IP Commands for TCP/IP Services
Since its release in 1991, Linux has become increasingly popular as a base. Approximately 1.84% of all desktops run Linux, and considering that there are roughly two billion desktops, servers, and laptops running in the world, that means Linux runs on an estimated 37 million computers. Chrome-OS, along with many other lightweight devices, use Linux kernel as their base because of its robust and highly customizable nature.
The command line tool is one of the most essential tools on a desktop, regardless of operating system. Understanding the most common command lines makes it easy to test your ping, perform a DNS test, or any number of simple tasks. Furthermore, if you have ever worked on servers, it's likely that you've come across some version of Linux and have had to use some of the Linux IP Commands listed below.
The following are some of the more frequently used command lines relating to Linux TCP/IP commands.
Description | Linux Internet Protocol Command |
---|---|
Display Current Config for all NICs | ifconfig |
Display Current Config for eth0 | ifconfig eth0 |
Assign IP | ifconfig eth0 192.168.1.2 |
Ping | ping -c 3 192.168.1.1 |
Assign multiple IPs | ifconfig eth0:0 192.168.1.2 |
Assign second IP | ifconfig eth0:1 192.168.1.3 |
Disable network card | ifconfig eth0 down |
Enable network card | ifconfig eth0 up |
View current routing table | route "or" route -n |
View arp cache | arp "or" arp -n |
Assign IP/Subnet | ifconfig eth0 192.168.1.2 netmask 255.255.255.0 |
Assign Default Gateway | route add default gw 192.168.1.1 |
Trace Route | traceroute www.whatismyip.com |
Trace Path | tracepath www.whatismyip.com |
DNS Test | host www.whatismyip.com |
Advanced DNS Test | dig www.whatismyip.com |
Reverse Lookup | host 66.11.119.69 |
Advanced Reverse Lookup | dig -x 66.11.119.69 |
Note that you must be at the root user to make or save any changes. If you are a Linux user, your distribution will determine the location of your network config file, which will then need to be updated and saved for the changes to remain in effect after rebooting. Network cards are referred to as eth0, eth1, eth2, etc based on their position on the PCI bus.
Replacing the Linux IP command ifconfig with ipconfig
Ifconfig has been around since 1983 and it is one of the more common command line interface tools used to help administrators of devices view and assign IP address information to network interface cards within the devices. In newer Linux distributions, however, the ifconfig command has been replaced with ipconfig and may not be available.
If you enter the ifconfig command and get an error message, switch to using the ipconfig command or install the deprecated ifconfig command.