Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have written an app which will run on a server. I have little experience with network configuration and such things.

Now I have set-up the server and everything works how I want however I want 2 things

  1. set the ip of my server to a static ip
  2. ideally be able to acces the server with a url like mytestserver.test or something like that

I do have experience with command line linux and windows but never needed to do anything with networks as I usually work with embedded systems

e\ my distribution is debian on the raspberry pi

share|improve this question
Which distribution are you using for the server? Setting up the static IP is a little different depending. And is it acceptable for the server to be accessible from that URL from only one machine or a small set, rather than a whole network or the internet? – Dylan May 17 '14 at 23:52
added in the question. – prgmjunkie May 17 '14 at 23:54
up vote 2 down vote accepted

Static IP

This is how to set up a static IP in Ubuntu if I recall correctly, it should also work in Debian and likely other Debian based distros:

You need to edit the network interfaces file located at /etc/network/interfaces, e.g.

nano /etc/network/interfaces

You should see a line like

iface eth0 inet dhcp

Comment this out with # and instead add:

iface eth0 inet static

EDIT: Explanation of network parameters

Address - Just the IP address of the server, this can be whatever you want as long as it's in the right subnet and not already used on your network

Netmask - This affects just what addresses you can use, for a home network this is almost certainly

Network - the address of the entire network, this is the first address in your subnet and will be the same first three sections as address and end with 0 on a typical home configuration

Broadcast - this one is the last address in the subnet, usually has the same first three sections as the address and ends with a 255 on a typical home network

Gateway - the address of the route, on a typical home network this is usually the second on the subnet (e.g. or

Alter with your own network parameters if they differ. Now, for DNS, edit /etc/resolv.conf and add a nameserver, e.g.:


You might be able to change the nameservers in the interfaces as well, but I can't remember for sure.

After you've done this, you'll need to restart the networking service:

/etc/init.d/networking restart

Setting a Host on Your Local Machine to Access a Dev Web Address

This is the easiest way to access your dev server at an address, but it'll only work for the machines you specifically set it for. I hope that's okay. You just need to edit the /etc/hosts file. Like so: mytestserver.test

Replace the IP address with the one for your server if different.

If you're on Windows the hosts file is at C:\windows\system32\drivers\etc. I think the syntax is the same.

share|improve this answer
thank you, address is obvious but what does the rest mean and how can I find out what I have to set it too? – prgmjunkie May 18 '14 at 0:23
I added a quick explanation of the network parameters. If you can tell me the address of your router or the server or really any other device on your network, and you're using a typical home or office network, I can probably tell you what the rest are likely to be. – Dylan May 18 '14 at 0:31
its a server at my work on a shielded network so I cant really acces it right now. typical adress range is 192.168.x.y the standard IP I got assigned from dhcp was with the server – prgmjunkie May 18 '14 at 0:50
Unless it's always 192.168.10.x that does complicate things a bit. In that case, my guess is that the values are as follows: Address: (if you can find one that's off their DHCP that might be good, but don't worry about it too much) Netmask: Network: Broadcast: Gateway: ...though technically it could be quite a lot of other things, since it sounds like they've already gone to the trouble of expanding the default subnet or just setting one up manually. – Dylan May 18 '14 at 1:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.