static ip

Discussion in 'Installation/Configuration' started by midgetcoach, Jan 14, 2009.

  1. midgetcoach

    midgetcoach New Member

    First time Linux user. Been trying to set up Ubuntu Server 8.10. Get to the part of the install that you change from DHCP to a static IP . Make the change and can not get on the internet. Change to look like this (with my numbers).
    # The loopback network interface
    auto lo
    iface lo inet loopback
    # The primary network interface
    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

    Then I lose the net.
    Running through a router.
    I have been messing with this for a week and still can't get it. I know it has to be something simple I'm missing.
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What's your router's internal IP address?

    Can you enable DHCP again and then post the outputs of
    Code:
    ifconfig
    and
    Code:
    route -nee
    ?
     
  3. midgetcoach

    midgetcoach New Member

    falko,
    Thank you for the reply. As you see I am very new to Linux and networking.
    I can get the IP from the router and also get the IP that my isp uses to the router. I have not seen or used "route - nee" code before???
    On my way out to work now but will post all info back later today.
     
  4. midgetcoach

    midgetcoach New Member

    Here is the info


    eth1 Link encap:Ethernet HWaddr 00:0d:88:21:da:92
    inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
    inet6 addr: fe80::20d:88ff:fe21:da92/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:13674 errors:0 dropped:0 overruns:0 frame:0
    TX packets:7325 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:18989941 (18.9 MB) TX bytes:464263 (464.2 KB)
    Interrupt:20 Base address:0xd400

    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:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)



    Router address internet IP address 192.168.15.2
    IP address 192.168.1.1

    route -nee
    Destination Gateway Genmask Flags Metric Ref Use Iface MSS Window irtt
    192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 0 0 0
    0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 eth1 0 0 0

    The system can access the internet for updates at this point.
     
  5. midgetcoach

    midgetcoach New Member

    With the info above can anyone show me what my should static IP look like? Every time I change it to static I lose the internet.
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Ok, you're using the 192.168.1.x subnet (instead of 192.168.0.x that I'm using in the tutorial), so you should use

    Code:
    auto eth0
    iface eth0 inet static
        address 192.168.[B][COLOR="Red"]1[/COLOR][/B].100
        netmask 255.255.255.0
        network 192.168.[B][COLOR="Red"]1[/COLOR][/B].0
        broadcast 192.168.[B][COLOR="Red"]1[/COLOR][/B].255
        gateway 192.168.[B][COLOR="Red"]1[/COLOR][/B].1
    in /etc/network/interfaces.
     
  7. midgetcoach

    midgetcoach New Member

    Thank you that got it ! Now I can move on with my server project. As soon as I get a chance I want to compare what I was doing wrong and to see how it should be done. Looking forward to learning!
    Thanks falko
     

Share This Page