Setting Up a Static IP Address on Ubuntu
Abstract
Learn how to configure a static IP address for your Ubuntu host.
1. Navigate to the Netplan Directory
Open your terminal and navigate to the Netplan directory:
2. Edit the Installer Configuration File
Use a text editor to modify the installer configuration file:
3. Modify the Configuration
Change the content of the file, and make adjustments to your needs:
network:
version: 2
renderer: networkd
ethernets:
ens18:
addresses:
- 192.168.1.35/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses: [1.1.1.1, 8.8.8.8, 4.4.4.4]
Note
- Replace ens18 with the appropriate network interface name (the one that is orginally in the network file).
- Adjust the IP address (192.168.1.35/24) and default gateway (192.168.1.1) as needed.
By following these steps, you can assign a static IP address to your Ubuntu host. Make sure to save the configuration file and apply the changes for them to take effect.