Results 1 to 9 of 9

Thread: Can connect to internet with DHCP but not with static IP

  1. #1
    Join Date
    Jun 2008
    Location
    USA
    Posts
    77

    Default Can connect to internet with DHCP but not with static IP

    Hi all,

    I'm using OpenSUSE 11.0, setting up a new system. I originally had the system set to use a dynamic IP via DHCP, which worked fine. I could connect to the LAN and the internet.

    Now I changed it to a static IP (10.10.10.10). I can still get to computers on the LAN, but not the internet.

    From the problem computer:
    nathan@ebisu:~> ping 10.10.10.1
    PING 10.10.10.1 (10.10.10.1) 56(84) bytes of data.
    64 bytes from 10.10.10.1: icmp_seq=1 ttl=255 time=0.202 ms
    64 bytes from 10.10.10.1: icmp_seq=2 ttl=255 time=0.182 ms

    nathan@ebisu:~> ping 74.125.47.104
    connect: Network is unreachable

    nathan@ebisu:~> ping Google
    ping: unknown host Google

    From another computer:
    charon [~] % ping Google
    PING Google (74.125.47.104): 56 data bytes
    64 bytes from 74.125.47.104: icmp_seq=0 ttl=245 time=27.715 ms
    64 bytes from 74.125.47.104: icmp_seq=1 ttl=245 time=35.276 ms

    More info:
    nathan@ebisu:/etc/sysconfig/network> cat ifcfg-eth0
    BOOTPROTO='static'
    BROADCAST=''
    ETHTOOL_OPTIONS=''
    IPADDR='10.10.10.10/24'
    MTU=''
    NAME='88E8056 PCI-E Gigabit Ethernet Controller'
    NETMASK=''
    NETWORK=''
    REMOTE_IPADDR=''
    STARTMODE='auto'
    USERCONTROL='no'

    Thanks in advance for any help.
    Nathan

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,941
    Blog Entries
    4

    Default Re: Can connect to internet with DHCP but not with static IP

    If you switch from DHCP to static IP, you have to provide a couple of other things manally, viz:

    The default gateway's IP address, which is your router's
    The nameserver(s) for name resolution, usually this is also the router as these days routers run a DNS proxy service.

    Look at the config on another computer. If Linux:

    Code:
    /sbin/route -n (the gateway is the one for 0.0.0.0)
    cat /etc/resolv.conf (the namesever IPs are evident)
    If Windows
    Code:
    ipconfig /all

  3. #3
    Join Date
    Jun 2008
    Location
    USA
    Posts
    77

    Default Re: Can connect to internet with DHCP but not with static IP

    ken_yap, thanks for the speedy reply!

    I had forgotten to add the route to the gateway.
    route add -n default gw 10.10.10.1 did the trick.

    Much obliged!

    Nathan

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,941
    Blog Entries
    4

    Default Re: Can connect to internet with DHCP but not with static IP

    Don't forget to make it permanent in YaST or you will have to do it again next boot. Also the nameservers.

  5. #5
    alisonccc NNTP User

    Default Re: Can connect to internet with DHCP but not with static IP

    I seem to have the same problem, but following the previous help doesn't seem to fix it.

    Set a static IP address to 192.168.1.20 on eth0 via Network Settings. Added a "route add -n default gw 192,168,1,20" and set the nameserver to my ADSL2M/routers IP address of 192.168.1.254 a Billion 7404VGO-M. Can access all other machines on the network, even the router, but tried Google and Firefox said it couldn't find it.

    Yet the moment I switch eth0 back to DHCP everything comes good.

    Alison

  6. #6
    Join Date
    Jun 2008
    Location
    USA
    Posts
    77

    Default Re: Can connect to internet with DHCP but not with static IP

    Alison,

    It looks like you're setting the default gateway to your own computer's IP. You should be setting the default gateway to the IP of the router.

    Nathan

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,941
    Blog Entries
    4

    Default Re: Can connect to internet with DHCP but not with static IP

    Also make sure that 192.168.1.20 is not within the dynamic range served by the router. The router is entitled to ignore any clients that take addresses within the dynamic range without asking.

  8. #8
    alisonccc NNTP User

    Default Re: Can connect to internet with DHCP but not with static IP

    Thanks Nathan and Ken, everything's now sorted. Disabled the DHCP server in the router and set all machines to static IP's. There may be a bug in the router firmware that's been causing probs.
    Alison

  9. #9
    admars NNTP User

    Default Re: Can connect to internet with DHCP but not with static IP

    Hi,
    I was having trouble with this yesterday.
    I'm using openSUSE 11.0 and mainly KDE4.4.1
    using yast2 i set my ip address to a static one, but it doesn't remember what I put in for the DNS server.

    if I then manually edit my /etc/resolv.conf

    to put
    nameserver router's ip address
    nameserver ISP's DNS server

    it works, until a reboot, when that file gets changed (the file does say not to alter by hand)
    Cheers
    Al

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •