I believe there maybe a different way of doing this in version 18.04, but I think I have version 16.
lsb_release -a
Responds: Description Ubuntu 16.04.3 LTS
sudo vim /etc/network/interfaces
Responds: Opens the interfaces file
Note: iface eth0 inet dhcp — that means that I’m currently set to DHCP vs. Static
Made some edit and adds to this file:
Edits: From dhcp to static
Add: Everything else — I confirmed my Internet router info is correct in file
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1
Note: To save and quit from vim — :wq
Reboot the server: sudo reboot (Note: There may be a more elegant way)
Note: I had been logged in to my Netgear, and before connecting to UbuntuServer, noticed that the IP is now 192.168.1.10 — which is correct
Make a connection:
ssh paul@192.168.1.10
Ping the outside:
ping google.com — that worked.
Summary: Now I have a static ip address on UbuntuServer 16.04