X
    Categories: Ubuntu

How To Configure Static IP Address On Ubuntu 21.04 Server

In this tutorial how to configure static IP address on your Ubuntu 21.04 server. Static IP address is manually setup IP system. It’s very important because your local network DHCP server always provide new IP to your host machine. So If you don’t use a static IP address on your server so you can see some time your server IP address change.

How To Install Rocket.Chat On Ubuntu 18.04 TLS
How To Install Bitwarden Password Manager On Ubuntu 18.04 Using Docker

Step #01: Check server version using below command.

root@ubuntu21:~# lsb_release -a && ip r

Output as like below

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04.5 LTS
Release: 21.04
Codename: hirsute
default via 10.66.100.10 dev enp0s3 proto static
10.66.0.0/16 dev enp0s3 proto kernel scope link src 10.66.100.9

Step #02: Configure static ip address on Ubuntu 21.04 server.

Open netplan config file using any editor.

root@ubuntu21:~# vi /etc/netplan/00-installer-config.yaml

Then insert all below lines into your file. or you can edit your old text and replace interface and ip address as like you want.

network:
  ethernets:
    eth0:
      dhcp4: no
    eth1:
      dhcp4: no
      addresses: [10.66.100.9/16]
      gateway4: 10.66.100.10
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]

Then save press Esc type :wq then press Enter.

Finally run netplan apply command as like below.

root@ubuntu21:~# netplan apply

If your configure is success so you can’t see any error. But remember if your configuration include any white space so can’t properly run netplan command.

So I recommend your old text delete then copy my code and paste into your file then run netplan command.

If you want to see my YouTube channel for more details video.

1 1 vote
Article Rating
Admin: I am system administrator as Windows and Linux platform. I have 4 years skilled from the professional period. I have to configure Linux based system such as an Asterisk VOIP system, Network monitoring tools (ZABBIX), Virtualization (XEN Server), Cloud computing (Apache CloudStack) etc. Now share my professional skill each interested person. Thanks to all.
Leave a Comment