Set a static IP in the terminal (Ubuntu)

Edit the interfaces file with: ‘sudo nano /etc/network/interfaces’

Update the file from DHCP to static and complete the final lines as per the example below:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
    address 192.168.1.50
    netmask 255.255.255.0
    network 192.168.1.1
    broadcast192.168.1.255
    gateway 192.168.1.1
    dns-nameservers 192.168.1.1 8.8.8.8
    dns-domain homelab
    dns-search homelab
Sidebar