List of content you will read in this article:
The Linux operating system has versions available. Ubuntu Linux is one of the most famous and widely used versions of this operating system. If you are using this operating system or want to start it, after installing the operating system, the first and most important thing to do is to configure the IP. Please keep reading to get used to it.
Initial IP settings:
To configure IP in Ubuntu Linux, first, enter the following path in a command processor:
This tutorial will use the vi command processor to perform the steps.
Then enter your IP address in the following order:
auto eth0 iface eth0 inet static address 192.168.1.150 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.1.255 gateway 192.168.2.1
Then enter your IP in front of the address option and follow the steps below:
- In front of the netmask option, enter your subnet address;
- In the network option, you must enter your network address;
- In the last two options, you must enter your broadcast and getaway, respectively;
- In this way, the initial IP configuration in Ubuntu Linux is done successfully.
Once you have done the steps in retrospect, now it's time to set up DNS:
- First, follow the following path with the vi editor
Then enter the list of expressions below the mentioned DNS addresses. You can use the DNS addresses of your choice and enter them instead of the default addresses in this section:
nameserver 126.96.36.199 nameserver 188.8.131.52
Finally, you should save the file and close the page; this way, the DNS setting is done successfully.
⭐⭐Experience unmatched performance, flexibility, and security with our Ubuntu VPS servers. Empower your business with blazing-fast speeds, full root access, and seamless scalability, all backed by the rock-solid stability and open-source power of Linux. ⭐⭐
In the next step of IP configuration in Ubuntu Linux, you must remove it from your system to prevent the IP from being registered by DHCP. To do so, enter the following address in your editor:
apt-get remove dhcp-client;
This way, DHCP is removed, and your IP remains fixed in the system.
Restarting the network card:
As the last step to configure IP in Ubuntu Linux, you must configure your network card once.
To do this, enter the following statement in the editor:
ifdown eth0 && ifup eth0
After you reset your network card, use the following command to ensure the correct IP configuration:
After entering this command, you will be shown a page containing general system IP specifications. Dear ones, you can check each set item, and if any of them are incorrect, configure the IP again through the mentioned steps.
Finally, to test, you can ping a website to see if the IP configuration is done correctly or not. To do so, enter the ping command along with the address of your desired site, like ping google.com—if you see a page similar to the one below, the DNS and ip configuration settings are done correctly.
In this article, we tried to teach you how to configure your Linux IP in the best way. By following the mentioned steps, you can complete the IP settings of your system so that you don't face the problem of internet interruption and lack of network connection while using the Ubuntu Linux operating system.
People also read: