0

I'm having some problems configuring a static IP on my ubuntu server. What is the easiest way to configure IP, netmask, nameserver and default gateway on eth0?
I've tried modifying the /etc/network/interfacesfile but the interface goes down after reboot. I need to do this in CLI.

This is what the file looks like (without the comments):

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 172.16.61.4
    netmask 255.255.255.192
    nameserver 172.16.61.2
    broadcast 172.16.61.63

EDIT: It seems to work now. However, nslookup doesn't find any matches at all. Local nslookups on the 2008 server running dns works.

1
  • That's the correct place to do it, perhaps you should include the content of that file in your question. Maybe its just missing something. May 17, 2012 at 12:12

1 Answer 1

1

The nameserver should be placed in /etc/resolv.conf, exactly as you have it above.

Also, add the domain name used in the local network, to avoid having to use fqdn for lookups:

domain local
nameserver 172.16.61.2

Replace local with whatever your local domain is.

5
  • It's a switched LAN so no gateway should be needed, right? I'm still able to ping when I start the interface again. May 17, 2012 at 13:00
  • 1
    Sorry @FilipHaglund, I don't follow your question. If you need to access anything outside of the local lan, you need routing. If you need to access the internet, you need a default gateway. Can you post an /sbin/ifconfig -a before and after you bring the interface up, along with a netstat -rn after?
    – Paul
    May 17, 2012 at 13:08
  • It's a local network without internet access. Routing table shows eth0 as default gateway and ping works. Nslookup doesn't. May 17, 2012 at 13:17
  • Ah right. Your question asks where the default gateway should be configured. I have altered my answer in response to your new information
    – Paul
    May 17, 2012 at 14:09
  • Missed your /etc/resolv.conf. I was adding the nameserver to /etc/network/interfaces file. Guess I'm too used to having links formatted like this. It works now though! Thanks! May 17, 2012 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .