So I have a linux server running ubuntu. I set this thing up a while ago and setup a static IP and everything has been fine, up until now. Today, there was a power surge at my house and the server is now using the wrong IP address, is ignoring the /etc/network/interfaces file, and I can't restart networking.
ifconfig
ifconfig
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.8 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::a250:98ca:d9cc:188 prefixlen 64 scopeid 0x20<link> ether 30:85:a9:8d:fa:d5 txqueuelen 1000 (Ethernet) RX packets 815 bytes 731980 (731.9 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 695 bytes 86443 (86.4 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 255 bytes 21586 (21.5 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 255 bytes 21586 (21.5 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0Interfaces file
cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto enp3s0
iface enp3s0 inet dhcp
auto lo enp3s0
iface lo inet loopback
iface enp3s0 inet static address 192.168.1.7 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 75.75.75.75 75.75.76.76Resolves to two hostnames (which doesn't make sense to me)
hostname -I
192.168.1.8 192.168.1.7Network restart failure
sudo /etc/init.d/networking restart
[....] Restarting networking (via systemctl): networking.serviceJob for networking.service failed because the control process exited with error code.
See "systemctl status networking.service" and "journalctl -xe" for details. failed!systemctl status networking.service
systemctl status networking.service
● networking.service - Raise network interfaces Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2019-08-09 22:05:47 MDT; 25s ago Docs: man:interfaces(5) Process: 2137 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE) Main PID: 2137 (code=exited, status=1/FAILURE)
Aug 09 22:05:46 SilverServer dhclient[2160]: DHCPACK of 192.168.1.8 from 192.168.1.1 (xid=0x7b2bf54d)
Aug 09 22:05:46 SilverServer ifup[2137]: DHCPACK of 192.168.1.8 from 192.168.1.1 (xid=0x7b2bf54d)
Aug 09 22:05:46 SilverServer ifup[2137]: RTNETLINK answers: File exists
Aug 09 22:05:47 SilverServer dhclient[2160]: bound to 192.168.1.8 -- renewal in 37852 seconds.
Aug 09 22:05:47 SilverServer ifup[2137]: bound to 192.168.1.8 -- renewal in 37852 seconds.
Aug 09 22:05:47 SilverServer ifup[2137]: RTNETLINK answers: File exists
Aug 09 22:05:47 SilverServer ifup[2137]: ifup: failed to bring up enp3s0
Aug 09 22:05:47 SilverServer systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Aug 09 22:05:47 SilverServer systemd[1]: networking.service: Failed with result 'exit-code'.
Aug 09 22:05:47 SilverServer systemd[1]: Failed to start Raise network interfaces.I want the server to start up using 192.168.1.7, but I can only connect to it with putty through 192.168.1.8. I've been working on this problem for two hours now and have gotten nowhere. Please help, happy to clarify anything and happy to try anything.
Thanks!
11 Answer
You have enp3s0 set to use dhcp AND static IP addresses.
Change your /etc/network/interfaces to this...
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp3s0
iface enp3s0 inet static address 192.168.1.7 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 75.75.75.75 75.75.76.76