Finding the IP address in Linux is not a very difficult job. In this Buzzle article, in addition to finding your IP address, we also give you basic information an IP address, and how we can assign a new IP address to a computer in Linux.
Finding an IP address in Windows is easy enough, and the same is true for Linux. But before we go finding out IP addresses left, right, and center, let us take a look at what an IP address really is.
For those of you who don’t know exactly the use of an IP address, let me try to explain it to you in detail. An IP address is an abbreviation for ‘Internet Protocol’ address. Well, these are 32-bit numbers stored in binary format but displayed to the user in the human readable form. It is used to identify the different machines in a network. Every machine in a network needs a unique IP address. This helps in the transfer of data as the number specifies the name of the machine, the address, as well as the route. Another important aspect, 32-bit numbers are used for the IP version 4 or IPv4, but in case of Ipv6 (IP version 6), 128 bits are used for addressing the computers in a network. The IP address is usually represented in the form of x.x.x.x where x is an 8-bit number.
How to Find an IP Address in Linux
The simplest way to check the IP address when using Linux is using the bash shell and typing the command ifconfig. On typing the ifconfig you will not only be provided with the IP address, but also the MAC address, subnet mask, and other information. If you get confused because of the huge amount of information displayed on typing theif-configg command, then let me tell you that the number following the inet addr under eth0 is the IP address of the machine on which you are working. Alternately, you can also use the command ip address show. On typing the command you will get an output something like inet 192.168.1.15/24. Here the /24 means that the subnet mask is 255.255.255.0. Similarly /8 would mean that the subnet mask is 255.0.0.0.
How to Change IP Address
Changing IP addresses in Linux is as easy as viewing the IP address. On the bash shell type ifconfig eth0 192.168.254.8 net mask 255.255.255.0 up. Here 192.168.254.8 is the new IP address. Using this command, you can set your IP address for that particular session to this particular IP address. But to change the IP address permanently, you need to change the configuration file and the process to do so depends on your Linux version. Let me give you an example. To change the IP address permanently in Red Hat Linux, login as the root, and type the command system-config-network-tui &. You will now see a text-based GUI. Click on the option to enlarge image. Here you can make all your changes. You can set your network interface card, set your IP address, subnet mask, and default gateway, or you can simply select the option for DHCP (Dynamic Host Configuration Protocol) to assign you the IP address automatically.
This was all the information that I can provide you on how to find IP address in Linux. It is a simple process. Here, in this article, I have tried to implement the command line approach for it is the command line interface which attracts so many computer users to this wonderful operating system.