Debian-Sarge : Not picking up the IP address on reboot

Discussion in 'HOWTO-Related Questions' started by contactme, Jan 8, 2007.

  1. contactme

    contactme New Member

    Hi,
    I am running Debian Sarge. I have made changes to /etc/network/interfaces file so that it should pick the static IP address I am assigning. So my file looks like:

    # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

    # The loopback interface
    auto lo
    iface lo inet loopback

    # The first network card - this entry was created during the Debian installation
    auto eth0
    iface eth0 inet static
    address 192.168.XX.ABC
    netmask 255.255.255.0
    gateway 192.168.XX.Z


    But whenever I reboot my system, it doesn't take this IP address, and shows something like 10.0.X.X. I have to again run "ifdown eth0" and "ifup eth0" to get the required IP assigned.

    What should I do so that it keeps the desired IP even after reboot. This may not be the right file where I need to set the static IP address. I need some help as I am pretty new to Debian.

    Thanks Guys!
     
  2. falko

    falko Super Moderator Howtoforge Staff

    The file must look like this:

    Code:
    # The loopback interface
    auto lo
    iface lo inet loopback
    
    # The first network card - this entry was created during the Debian installation
    # (network, broadcast and gateway are optional)
    auto eth0
    iface eth0 inet static
            address 192.168.0.100
            netmask 255.255.255.0
            network 192.168.0.0
            broadcast 192.168.0.255
            gateway 192.168.0.1
    (use your own IP addresses). The leading spaces are important.

    Also, make sure you use Unix linebreaks in the file when you save it.
     
  3. contactme

    contactme New Member

    Nope, that didn't work.

    I had modified the file as you had specified and my file now looks like:


    # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

    # The loopback interface
    auto lo
    iface lo inet loopback

    # The first network card - this entry was created during the Debian installation
    auto eth0
    iface eth0 inet static
    address 192.168.0.179
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1



    When I rebooted the machine, it came up with 10.0.0.149 and with odd BCast & Mask value as well.

    Looking around for help.
     
  4. contactme

    contactme New Member

    And, I am having spaces, as you had mentioned, not sure why those are not being displayed here.
     
  5. contactme

    contactme New Member

    Other thing is that, after I reboot, if I type ifdown eth0, it gives me a message:

    SIOCDELERT: no such process

    And after that I have to do ifup eth0 to take it my intended IP which I am mentioning in interfaces file.

    Any suggestions what to look for ? Is it that eth0 is not coming up on it's own ?

    A snippet of ifconfig for eth0

    inet addr:10.0.0.149 Bcast:10.255.255.255 Mask:255.0.0.0

    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:1471 errors:0 dropped:0 overruns:0 frame:0
    TX packets:254 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:190424 (185.9 KiB) TX bytes:19553 (19.0 KiB)
    Interrupt:177 Base address:0xb400
     
  6. martinfst

    martinfst Member Moderator

    This is really funny. The ifconfig shows you have IP address 10.0.0.149 assigned, but yet your config indicates it should be 192.168.0.179.

    Are you maybe playing with Virtual Machines?
     
  7. contactme

    contactme New Member

    I have the virtual machine setup as well on this system. Though don't know how that's been setup as it was already there and I am handling an old system.

    Almost same thing happens with virtual machin, wheevr I bring that up using VMWare, it somehow goes back to some old IP which I have to reset again.


    Just to mention that above ifconfig output was taken before doing ifdown eth0 and ifconfig eth1.

    After doing ifup eth0, ifconfig shows me the correct intended IP address.
     
  8. falko

    falko Super Moderator Howtoforge Staff

    Because you didn't mark it as code here.

    What's the output of
    Code:
    ls -la /etc/network
    ?
     
  9. contactme

    contactme New Member

    Hi Guys,
    Finally figured this out.

    That script/configuration file is being run from /etc/rcS.d directory. and when I commented that line, my system came back with the correct IP :-D

    One problem resolved. though I'm still need to find out why that's there and how it's been used to setup VLANs.


    thanks guys
     
  10. contactme

    contactme New Member

    The above comment was related to :

    "I have found one configuration file which has

    ifconfig eth0 10.0.0.149 up


    But still trying to find out from where it's being read ? " and finally I figured that out in /etc/rcS.d directory.
     
  11. martinfst

    martinfst Member Moderator

    Everything with /etc/rc* is processed during boot. That's by default in any Unix/Linux flavor, though there are variations in the details. HTH
     

Share This Page