I used to have routers which allowed to make ip reservations based on MAC. But my current router doesn't have this option. What is the alternative for that?

Why do I need it? I have a Debian server for personal needs and I want to setup some port forwardings, ssh etc. So I need to have a static ip on this server. I do not want to create a static configuration on Debian machine, in that case I will need to explicitly show gateway ip address etc. Probably some scripts exist which may do a network lookup and dynamically search for a gateway/router address when eth0 is up. Could someone advise a good solution?

  • 1
    you could install a DHCP server on some other box on the network. most distros have reservation features. – Frank Thomas Jul 19 '13 at 23:33
  • Heck, you can make that Debian server BE the DHCP server, but obviously you don't make it also a DHCP client. So the "static IP" answer below is the right answer. :-) – Warren P Jul 27 '13 at 3:20
  • I am using a static configuration for now. – Druid Sep 14 '13 at 14:34

assign as static IP to your "server". you can do so by editing /etc/network/interfaces like this:

auto  eth0
## uncomment the line that says DHCP
#iface eth0 inet dhcp
## add static IP-settings
iface eth0 inet static

this will assign your machine an IP obviously you should assign your server a valid IP for your subnet (the given configuration assumes that your DHCP-server gives out IP-addresses in the 192.68.0.x range).

you should also make sure to not use an IP that the DHCP-server might give out. usually you can configure it, to e.g. only hand out IPs in a certain range (e.g. mak sure that your static IP is outside this range and does not collide with other devices (namely the router itself - most likely; and the network&broadcast addresses &

  • This. Then you can either just add this IP to other machine's /etc/hosts file if you want to be able to ping it and ssh into it by a name instead of just by its dotted ip number. – Warren P Jul 27 '13 at 3:18

Your router probably enables you to reserve a range of unused IPs. You can then set this range in a DHCP server, or even statically if your configuration is simple enough.

An alternative is if your router enables you to set very long lease times.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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