PDA

View Full Version : [SOLVED] Statically assigned IP address won't work on reboot.



zeddy2
July 30th, 2015, 02:37 AM
I installed Ubuntu 15.04 mini in a Virtualbox VM with the network bridged. The install automatically enables DHCP which works fine. In order to statically assign an IP address, I edited /etc/network/interfaces to look like the following:

auto eth0
iface eth0 inet static
address 10.168.1.218
gateway 10.168.1.1
netmask 255.255.254.0
dns-nameservers 10.168.1.210


If the networking service is restarted, the static address works fine. On reboot, eth0 is up and an ifconfig shows the correct IP, but I can’t ping other devices, i.e. the gateway, and other devices can’t ping this machine. A simple ifdown/ifup cycle will kick it back in gear as will the networking service restart, but I’m hoping to find a way to make the static ip assignment work upon reboot. I’ve looked at the syslog and didn’t see anything unusual regarding eth0.

papibe
July 30th, 2015, 02:47 AM
Hi zeddy2. Welcome to the forum ):P

Could you run these commands, and post back the results (you can copy/paste the text)?

ifconfig

cat /etc/network/interfaces

cat /etc/resolv.conf

ls -l /etc/resolv.conf

ps aux | grep dhc

apt-cache policy network-manager

[ -f /usr/bin/nm-tool ] && nm-tool
Regards.

zeddy2
July 30th, 2015, 03:28 AM
Thanks for the warm welcome. Here are the results (not sure if I got everything on the last command??):




ifconfig


username@ComputerName:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:de:33:7a
inet addr:10.168.1.218 Bcast:10.168.1.255 Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2076 errors:0 dropped:0 overruns:0 frame:0
TX packets:539 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:165769 (165.7 KB) TX bytes:45560 (45.5 KB)


lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:169 errors:0 dropped:0 overruns:0 frame:0
TX packets:169 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15817 (15.8 KB) TX bytes:15817 (15.8 KB)


username@ComputerName:~$


cat /etc/network/interfaces


username@ComputerName:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback


# The primary network interface
auto eth0
# iface eth0 inet dhcp
iface eth0 inet static
address 10.168.1.218
netmask 255.255.254.0
gateway 10.168.1.1
dns-nameservers 10.168.1.210

username@ComputerName:~$

cat /etc/resolv.conf


username@ComputerName:~$ clear
username@ComputerName:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 10.168.1.210
nameserver 10.168.1.210

username@ComputerName:~$

ls -l /etc/resolv.conf


username@ComputerName:~$ ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Jul 28 17:35 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

username@ComputerName:~$

ps aux | grep dhc


username@ComputerName:~$ ps aux | grep dhc
username 1685 0.0 0.2 4528 2088 pts/1 S+ 22:17 0:00 grep --color=auto dhc

username@ComputerName:~$

apt-cache policy network-manager


username@ComputerName:~$ apt-cache policy network-manager
network-manager:
Installed: (none)
Candidate: 0.9.10.0-4ubuntu15.1
Version table:
0.9.10.0-4ubuntu15.1 0
500 http://us.archive.ubuntu.com/ubuntu/ vivid-updates/main i386 Packages
500 http://security.ubuntu.com/ubuntu/ vivid-security/main i386 Packages
0.9.10.0-4ubuntu15 0
500 http://us.archive.ubuntu.com/ubuntu/ vivid/main i386 Packages

username@ComputerName:~$

[ -f /usr/bin/nm-tool ] && nm-tool


username@ComputerName:~$ [ -f /usr/bin/nm-tool ] && nm-tool

username@ComputerName:~$

papibe
July 30th, 2015, 06:45 AM
Thanks. Nothing out of the ordinary there.

Is there any file on '/etc/network/interfaces.d/*' ? If so, could you post their content?

Can you ping the router (10.168.1.1)?

Another thoughts on setting up static IPs:

It has to be unused, and outside the DHCP range. What is your network's DHCP range?
It has to play by the rules of the network. Unless is behind a different router (VMs may apply) , it has to be in the same net range, and netmask than the other machines (255.255.254.0 is kind of unusual mask for home network. Is that your current netmask?)
Unless special services are setup, other machines won't be able to access it by name, only by IP.

Regards.

zeddy2
July 31st, 2015, 01:11 AM
Nothing in /etc/network/interfaces.d/

I can ping the router, but only after restarting the networking service upon reboot. On reboot the only thing i can ping is the loopback.

The IP is outside the DHCP range.

The subnet is indeed 255.255.254.0

I cannot ping the device by host name, but IP is fine for my use.


I've setup another mini with nothing else installed on it, and it exhibits the same behavior.

papibe
July 31st, 2015, 02:00 AM
Could you run these commands, right after a boot, that is, when ping is not working?

ifconfig

route -n

mtr --report -nc1 10.168.1.1

mtr --report -nc1 8.8.8.8
Regards.

zeddy2
July 31st, 2015, 02:33 PM
Here are the results:


ifconfig


username@ComputerName:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:de:33:7a
inet addr:10.168.1.218 Bcast:10.168.1.255 Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:239 errors:0 dropped:0 overruns:0 frame:0
TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16310 (16.3 KB) TX bytes:1560 (1.5 KB)




lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:27 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2453 (2.4 KB) TX bytes:2453 (2.4 KB)


route -n


username@ComputerName:~$ clear
username@ComputerName:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.168.1.1 0.0.0.0 UG 0 0 0 eth0
10.168.0.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
username@ComputerName:~$


mtr --report -nc1 10.168.1.1


username@ComputerName:~$ mtr --report nc1 10.168.1.1
Start: Fri Jul 31 08:58:16 2015
HOST: ComputerName Loss% Snt Last Avg Best Wrst StDev
username@ComputerName:$

mtr --report -nc1 8.8.8.8


username@ComputerName:~$ mtr --report nc1 8.8.8.8
Start: Fri Jul 31 09:01:06 2015
HOST: ComputerName Loss% Snt Last Avg Best Wrst StDev
username@ComputerName:$



A little more about my setup: The host server is Ununtu 14.04 with both gnome and Xfce installed.

I copied the Virtual disk onto a windows host and the static address works fine on reboot, so it must be something with the Ubuntu host. On the Ubuntu host, I originally had a static IP assigned through the gnome network manager. I have since disabled it and assigned the static IP through /etc/network/interfaces. The network connection still works fine on the host, but I get the same results on the Ubuntu 15.04 guest: static IP only works after restarting the Networking service.

Thanks so much for your help!

papibe
July 31st, 2015, 09:32 PM
A little more about my setup: The host server is Ununtu 14.04 with both gnome and Xfce installed.
Ok. This could be something.

When you have a desktop environment, usually the GUI tools take over the network administration. Some of the commands from post #2 tried to 'guess' if network-manager was installed. However, since you do have a desktop environment, I'd like to do a double take on this.

Do you have any other tool to manage the network? For instance wcid, Connman, etc? Note that one of them might get installed as a bundle when you installed the desktop.

You have the alternative of managing the static IP with any of those tools, however, you would have to restore the 'interfaces' file as it were.

Regards.

zeddy2
August 1st, 2015, 07:48 PM
I finally got it working. Not sure if all these things mattered, but the last step corrected the problem.

1. Removed the network-manager
2. Upgraded the host OS to 15.04
3. Changed the network adapter to PCnet-FAST III (Am 79C973)

Thanks a bunch for the help.