Linux Static IP configuration reset after every reboot/wake from sleep
#1
I've installed a fresh copy of XBMC Eden 11 as the only OS on an old laptop I'm using as the media PC. I've modified the /etc/network/interfaces file to configure the Ethernet connection to use a static IP:

Code:
auto lo eth0
allow-hotplug lo eth0

iface lo inet loopback

iface eth0 inet static
        address 10.0.0.99
        netmask 255.255.255.0
        gateway 10.0.0.1

This works fine if I run sudo /etc/init.d/networking restart, but uses DHCP-assigned IPs after waking from sleep or rebooting. How can I make it use static IPs after powerup?[/code]
Reply
#2
Mine works and looks like so:

Code:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.0.0.2
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
gateway 10.0.0.1
HTPC 1 - Zotac ZBOX ID80U | 4GB RAM | 64GB SSD | Openelec | Confluence
HTPC 2 - Zotac ZBOX ID41U | 4GB RAM | 60GB SSD | Openelec | Confluence
Server - unRAID Server | 3 x 2TB WD Green HDD, 1TB WD Black HDD (Cache) | Sabnzbd | CouchPotato | Sickbeard
Reply
#3
Like I said, mine works too, but I have to run `/etc/init.d/networking restart` for it to pick up the settings in the interfaces file every time I turn it.

It's like it's ignoring the static IP configuration after powering on for some reason. It is getting a DHCP address though.
Reply
#4
Could you not use your router to set the machine to have a static IP by mac address?

Just a thought.
Reply
#5
Also, I assume by assigning the address 10.0.0.99 that the router's DHCP range starts at 10.0.0.100? You don't want those to overlap.
HTPC 1 - Zotac ZBOX ID80U | 4GB RAM | 64GB SSD | Openelec | Confluence
HTPC 2 - Zotac ZBOX ID41U | 4GB RAM | 60GB SSD | Openelec | Confluence
Server - unRAID Server | 3 x 2TB WD Green HDD, 1TB WD Black HDD (Cache) | Sabnzbd | CouchPotato | Sickbeard
Reply
#6
(2012-04-02, 01:10)karandras24 Wrote: Could you not use your router to set the machine to have a static IP by mac address?

Just a thought.

I would recommend doing it this way. I used to use static IP assignment directly on my XBMC computer, and it worked great when I only have my media server/desktop and my XBMC computer running, but then after adding 2 android phones, 2 tablets, a laptop and another XBMC computer I started running into issues with duplicate IP assignments all over the place and it was a mess. Doing it on the router allows you to leave all your devices as DHCP, as the router will always assign it the same IP address no matter what, and you don't have to worry about address conflicts.
XBMCbuntu {Frodo} - Ubuntu 12.04 (Main):
Intel Q6600 [2.4GHz Quad Core], 4GB DDR3, nVidia GT-210, Antec Fusion Case (iMon LCD), PS3 BD Remote

XBMC Live {Frodo} - Ubuntu 10.04 (Bedroom): Intel Atom D510 [1.66GHz Dual Core], ION Graphics, 2GB DDR2, PS3 BD Remote
Reply
#7
Try moving the auto eth0 and allow hotplug eth0 out of the first stanza of the interface script and put it above the iface eth0 line. The network and broadcast statements should not be needed, as they are both defined under the netmask statement.

e.g.
auto eth0
iface eth0 inet static
addresss 10.0.0.99
netmask 255.255.255.0
gateway 10.0.0.1

Also, check out the output of dmesg to see if there's anything complaining about eth0 during boot.

It may not work, syntactically it looks fine, but it's a little out of the ordinary the way you have it now.
Reply

Logout Mark Read Team Forum Stats Members Help
Static IP configuration reset after every reboot/wake from sleep0