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

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:

/sbin/route -n (the gateway is the one for 0.0.0.0)
cat /etc/resolv.conf (the namesever IPs are evident)

If Windows


ipconfig /all

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

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

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

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

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.

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

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