5

I have a business class internet connection and need to setup a static ip address for a machine. I did a search online and only find how to setup static local ip addresses (like 192.168..). I tried the same technique, and only setup the ip address and netmask, but after restart networking the computer could not connect to the outside world.

This is what I did:

1) edit /etc/network/interfaces iface eth0 inet static address 173.10.xxx.xx netmask 255.255.255.252

2) edit /etc/resolv.conf search wp.comcast.net nameserver xx.xx.xx.xxx nameserver xx.xx.xx.xxx

3) restart network sudo /etc/init.d/networking restart

Now the last step didn't report error, ifconfig shows the ip address was set, but this server cannot connect to outside world, ping google.com and reports "unknown host google.com".

Any ideas?

1
  • 1
    Are you connected directly to the cable modem, or behind the router? Commented Apr 15, 2010 at 23:13

1 Answer 1

4

You are missing a default route.

In ubuntu, you'll need:

 gateway <IP of default route> 

Here is /etc/network/interfaces on my system (with a private IP, but there is no difference):

auto eth0 iface eth0 inet static address 10.22.16.2 netmask 255.255.255.0 network 10.22.16.0 broadcast 10.22.16.255 gateway 10.22.16.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 10.21.1.21 dns-search example.com 
1
  • Oha, it works now! It turns out I need to specify the gateway with the public IP address of the router. It didn't work earlier because I am setting an public ip for the server, but using a local LAN ip for the gateway. Commented Apr 15, 2010 at 23:35

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.