How To Configure Static IP Address On Ubuntu 21.04 Server3 min read
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.
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: [220.127.116.11, 18.104.22.168]
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.
We really appreciate for your support for buying me a coffee.
It takes us a while to compose and upload new content, as they have to be checked to see if Properly works. We appreciate you if you help me for one cup of coffee to keep us awake and always deliver good quality content.
No contribution is small of an amount. We are grateful for any amount you support us with. Thank you!