Linux Server Install: Part 5

Laxfed Paulacy
2 min readJan 6, 2023

Don’t be shocked with this one and setup a Static IP, bruh.

Previous

Static IP

To set up a static IP address on an Ubuntu 20.04 server and reserve it in the DHCP scope, follow these steps:

Determine the name of your network interface. You can use the ip command to list your network interfaces:

ip a

The interface you want to configure will typically be called eth0 (for a wired Ethernet connection) or wlan0 (for a wireless connection).

Let’s assume your IP address is: 192.168.0.165/24

Edit the /etc/network/interfaces file to configure the static IP address:

  1. Change dhcp4 to no (it was yes)
  2. On the addresses list specify the IP address that you want it to be: i.e., 192.168.0.222/24
  3. Next set the gateway, which is the gateway for the subnet (should be fine as is).
  4. Then in nameservers under addresses is another list. This is our nameserver list or “dns list”. For this we’ll use 192.168.0.4
  5. Save this file and we’ll close out.

Apply the settings:

sudo netplan apply

You might be thinking that didn’t work, well that’s because we just got disconnected from our SSH session since we have a new IP address. SSH again using the new IP and you should be able to get back in.

Run ip a again and you should see your new IP address.

Next

--

--

Laxfed Paulacy
Laxfed Paulacy

Written by Laxfed Paulacy

Delivering Fresh Recipes, Crypto News, Python Tips & Tricks, and Federal Government Shenanigans and Content.

No responses yet