Sunday, January 16, 2011

Ubuntu issues with IP

I'm having a really odd issue where ifconfig and my /etc/network/interfaces disagree. I have /etc/network/interfaces configured so eth0 has a static IP of 192.168.2.5; however, ifconfig says eth0's IP is 192.168.2.198 (in my DHCP range). As far of the rest of my network is concerned, the machine is located at 192.168.2.198 . I've tried restarting networking (/etc/init.d/networking restart) twice now, and that didn't resolve the issue.

/etc/network/interfaces

auto lo
iface lo inet loopback

iface ppp0 inet ppp
provider ppp0

auto ppp0

iface eth0 inet static
address 192.168.2.5
netmask 255.255.255.0
gateway 192.168.2.1

ifconfig

eth0  Link encap:Ethernet  HWaddr 00:19:b9:6d:a2:b1
      inet addr:192.168.2.198  Bcast:192.168.2.255  Mask:255.255.255.0
      inet6 addr: fe80::219:b9ff:fe6d:a2b1/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:301767 errors:0 dropped:0 overruns:0 frame:0
      TX packets:76931 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:153435880 (146.3 MB)  TX bytes:9934052 (9.4 MB)
      Interrupt:22

lo    Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:16436  Metric:1
      RX packets:23150 errors:0 dropped:0 overruns:0 frame:0
      TX packets:23150 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:9998881 (9.5 MB)  TX bytes:9998881 (9.5 MB)

wlan0 Link encap:Ethernet  HWaddr 00:19:7e:60:e7:b5
      UP BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
      Interrupt:16 Memory:ecffc000-ed000000
  • can you post the output of:

    cat /etc/network/interfaces
    

    and

    ifconfig
    

    edit: oops, I missed one:

    nm-tool
    

    I'm betting that NetworkManager is why your interface is pulling DHCP. Check Preferences > Network Connections.

    Shadow : See edits......
  • Below is my /etc/network/interfaces file for a static IP running Ubuntu:

    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    iface eth0 inet static
    address 10.10.100.17
    netmask 255.255.255.0
    network 10.10.100.0
    broadcast 10.10.100.255
    gateway 10.10.100.1
    

    Can you confirm that you are intentionally using the point to point protocol? Also, are you wanting PPP or PPPoE? If you are needing to use PPP, would the following work?

    auto lo
    iface lo inet loopback
    
    iface ppp0 inet ppp
          provider myisp
    
    auto eth0
    iface eth0 inet static
    address 192.168.2.5
    netmask 255.255.255.0
    broadcast 192.168.2.255
    gateway 192.168.2.1
    

    In the above, you'll need to replace myisp with your specific isp info. Also, if you are using PPP, could you post the output of:

    cat /etc/ppp/options   # or any other interesting files in this directory
    cat ~/.ppprc
    
    Shadow : I'm pretty sure the ppp interface was there since I installed the OS.
  • You don't have eth0 flagged as "auto" in /etc/network/interfaces. This means restarting networking is going to ignore that interface and it will just keep whatever config it already had (apparently a DHCP assigned address).

    Try this:

    1. Run "ifconfig eth0 0 down"
    2. Edit /etc/network/interfaces and add auto eth0 above the definition of the eth0 interface.
    3. Run "ifup eth0". It should come up with the address you assigned in /etc/network/interfaces.

    You may also want to check your process table for an instance of dhclient. If it's there, kill it.

    Shadow : Thanks! That fixed it.
    From Insyte

0 comments:

Post a Comment