Change Host IP through terminal

Nathan Davis

Member
Aug 27, 2017
8
1
23
30
I have moved my server to a new network with a different subnet. I changed my /etc/network/interfaces and /etc/hosts but I can't relove hosts from apt update. I am able to ssh into the host but not access the webui.


root@san-jacinto:~# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.167.1.5 san-jacinto.com san-jacinto pvelocalhost

# The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

root@san-jacinto:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback

iface enp4s0 inet manual

auto vmbr0
iface vmbr0 inet static
address 192.167.1.5
netmask 255.255.255.0
gateway 192.167.1.1
bridge_ports enp4s0
bridge_stp off
bridge_fd 0

root@san-jacinto:~# apt update
Err:1 download.docker.com/linux/debian stretch InRelease (was https)
Could not resolve host: download.docker.com
 
Did your name server change too (/etc/resolv.conf) or do you have a route to your dns? While changing the IP is possible, you might run into other errors as during installation the IP is wirten to many different locations. For that a re-installation is recommended.

And I hope it is by intention, that you are using a non private IP range?
https://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces