1

I am following this tutorial for setting up a testing server for my web development projects.

When I attempt setting up a static IP address (using the configuration below), I receive the error "ping: unknown host www.google.com" when I attempt using ping.

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 

Ping works fine when the configuration is:

auto eth0
iface eth0 inet dhcp

I am a novice to server setup and administration.

Here is the output from /sbin/ifconfig eth0, as requested:

eth0    Link encap:Ethernet HWaddr 00:08:a1:0d:93:a1
        inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0
        inet6 addr: fe80::208:a1ff:fe0d:93a1/64 Scope:Link
        UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
        RX packets:69 errors:0 dropped:0 overruns:0 frame:0
        TX packets:303 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:9323 (9.3 KB) TX bytes:12240 (12.2 KB)
        Interrupt:21 Base address:0xd800

Output from route -n:

Kernal IP routing table
Destination    Gateway      Genmask        Flags Metric Ref  Use Iface
192.168.0.0    0.0.0.0      255.255.255.0  U     0      0    0   eth0
0.0.0.0        192.168.0.1  0.0.0.0        UG    100    0    0   eth0

DNS information from /etc/resolv.conf:

nameserver 192.168.1.1
nameserver 71.242.0.12
domain home
search home
voretaq7
  • 79,345
  • 17
  • 128
  • 213
Mike Moore
  • 223
  • 2
  • 7
  • 15
  • Are you sure you're using the correct subnet for the network you're on? Is 192.168.0.1 the IP address of your router? Can you ping the router? – EEAA May 15 '10 at 20:27
  • @ErikA I just pinged my router (`191.168.1.1`) and it says "Destination Host Unreacheable" – Mike Moore May 15 '10 at 20:35

1 Answers1

1

did you run /etc/init.d/networking restart

you can also do:

/sbin/ifconfig eth0 192.168.0.100 netmask 255.255.255.0 up
/sbin/route add default gw 192.168.0.1 eth0

that should bring up eth0, and allow you to try pinging things, if restarting networking fails

cpbills
  • 2,692
  • 17
  • 12
  • use `/sbin/ifconfig eth0` to display what your network settings are, if you're still having problems, and post them to your question, so we can see. in `/etc/network/interfaces` i'm pretty sure you don't /need/ `network` and `broadcast`, just in case they're "wrong" – cpbills May 15 '10 at 19:59
  • @cpbills Restarting and the other suggestions did not fix the issue. I just posted the output from `/sbin/ifconfig eth0` as you requested. Thank-you for your help. – Mike Moore May 15 '10 at 20:10
  • can you show us the output of `route -n`, also, check `/etc/resolv.conf` for DNS host data, you should have at least one `nameserver` entry – cpbills May 15 '10 at 20:23
  • @cpbills I just added output from `route -n` and `/etc/resolv.conf` – Mike Moore May 15 '10 at 20:34
  • if your router is 192.168.1.1, then you need to change your IP and gateway to be `192.168.1.100` and `192.168.1.1` – cpbills May 15 '10 at 20:38
  • with a netmask of 255.255.255.0, 192.168.0.X cannot talk to 192.168.1.X – cpbills May 15 '10 at 20:39
  • @cpbills THANKS!!! Matching the IP and gateway to the router worked. – Mike Moore May 15 '10 at 20:40