Configure IP Address on Linux CLI (Command Line Interface)

in networking •  4 years ago  (edited)

Addressing the IP Address on Linux is different from addressing the IP Address on Windows which only relies on its GUI especially if you use the Linux CLI, of course, it will be difficult, especially for people who are new to Linux knowledge.

Here I am using Linux Debian 10.1 which is the latest version at this time, if you are using an earlier version of Linux then it doesn't matter, because the IP address remains the same, let's just start.

Edit the Network configuration file

root@popon:~# nano /etc/network/interfaces

Then a file will appear containing the following syntax:

Debian 10.1-2020-03-31-14-06-42.png

Then change and add the configuration to be as follows:

2.png

Above I gave a "#" sign to make the line only a line that will not be in the configuration, then I added a new line and there are a few things that must be understood from the network configuration syntax on Linux so that the configuration can be understood properly.

  • "#" (to make a line as a comment/note only)

  • Auto and allow-hotplug in full can be seen here https://lists.debian.org/debian-user/2017/09/msg00911.html the author is still difficult to explain for fear of misunderstanding :)

  • ens32 (interface name that is given automatically by Linux to label the NIC card, on previous Linux versions of Debian 9 and below it is called eth)

  • static and DHCP (how to name the IP that we will do automatically / DHCP or manually / static)

  • address (IP Address that we give to the interface with IP configuration manually)

  • netmask (subnetting rules on the IP address to divide the segment)

  • broadcast (this is also, to declare IP Broadcast on a network)

  • gateway (it can be said as the gateway to the connection / if you want to add the internet, we must determine the IP of the device that is connected to the internet, such as a router device)

  • DNS-nameserver (DNS server that will be the address referred to on the computer)

So after that exit the configuration with:

CTRL + O and CTRL + X

Then after the configuration is successfully saved, then restart the Networking package

root@popon:~# /etc/init.d/networking restart

3.png

After appearing [ok], the IP address configuration is successful, and check the IP addressing

root@popon:~# ip a

4.png

So the configuration is successful, ens32 is the interface label of the hardware / NIC card
to test simply by using ping.

root @ popon: ~ # ping [connected_computer_ip]

Debian 10.1-2020-03-31-15-18-39.png

the IP address configuration runs successfully, that's my discussion about IP address configuration, Hopefully Helpful.

Source:

https://www.nano-editor.org/dist/v2.1/nano.html
https://wiki.debian.org/NetworkConfiguration

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!