Jumat, 15/11/2024 - 16:21 WIB
IndonesianArabicEnglishRussianGermanFrenchChinese (Simplified)JapaneseMalayHindi

TERBARU

TEKNOLOGITUTORIAL

Steps How to Configure a Static IP Address on Ubuntu 20.04 Operating System

It is a good idea to set a static or fixed ip address to a server so that you can guarantee that the machine will always have the same ip address to make it easier to connect to.

We prefer to set a static ip dynamically using my dhcp server but if you prefer to add a static IP address then this can easily be done using the following process:

Set a static IP address:

Find the correct interface name:

Open a terminal and run the following command:

ip a

 

In the example above the network card is eth0 as it is the only interface with an ip address.

Backup the networking file

It is a good idea to back up the networking file before you make any changes so that it can be quickly reverted if things go wrong. Run the following command to make a backup copy of the file:

sudo cp /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.bak

This will create a file called 00-installer-config.yaml.bak in the /etc/netplan/ folder in case you need it.

Edit the 00-installer-config.yaml file to set the static IP Address

Edit the 00-installer-config.yaml file in your desired editor

vim /etc/netplan/50-cloud-init.yaml

If your server is set to dhcp then you will see something like:

Edit the file to look something like:

Save the file.

Apply the changes:

sudo netplan apply

Statistic IPThe server will then be using the new address. If you were connected via ssh you will have to open a new session and connect to the NEW IP ADDRESS:

Statistic IP

The server will now use this address every time it is rebooted from now on.

To revert the changes you just need to do the following:

Over write the edited file with the backup file:

sudo cp /etc/netplan/50-cloud-init.yaml.bak /etc/netplan/50-cloud-init.yaml

Statistic IPReload netplan:

sudo netplan apply

The server will now be configured for dhcp and should have its old ip address again:

The server is now ready to install what ever software that you would like to install. For some ideas of what to install go to our Ubuntu Section of the site.


Reaksi & Komentar

وَلَقَدْ أَنزَلْنَا إِلَيْكَ آيَاتٍ بَيِّنَاتٍ ۖ وَمَا يَكْفُرُ بِهَا إِلَّا الْفَاسِقُونَ البقرة [99] Listen
And We have certainly revealed to you verses [which are] clear proofs, and no one would deny them except the defiantly disobedient. Al-Baqarah ( The Cow ) [99] Listen

Berita Lainnya

Tampilkan Lainnya Loading...Tidak ditemukan berita/artikel lainnya.
IndonesianArabicEnglishRussianGermanFrenchChinese (Simplified)JapaneseMalayHindi