views:

1383

answers:

6

I know that 127.0.0.1 is by convention loopback and that there are various address ranges which are reserved for local use. Is there an IP address that is reserved never to be assigned.

I would like to test that something works when an IP address can't be found, I could just use a local address which isn't used but thought that there may be an address which is reserved for such use.

A: 

Take a look at IP addresses

Gary Green
+1  A: 

Anything in the

10.0.0.0/8
172.16.0.0/12
192.168.0.0/16

ranges will be dropped by any Internet router - they are intended for internal use only and are not routed. There isn't a single address but using one from a block you don't use internally, as long as your router isn't too clever will do the job.

Of course if you have a managed router it may well drop these anyway and not let them go out of the internal network.

RFC-3330 lists these, and lots of other blocks as well

Alan Mullett
A: 

I think you may want to reword your question. The private address segments (10.0.0.0 - 10.255.255.255, 172.16.0.0 - 172.31.255.255, 192.168.0.0 - 192.168.255.255) are commonly referred to as "non-routable" addresses. I think what you are asking for is a reserved IP address that is reserved specifically to never be assigned. As far as I know there is no address that is reserved in this fashion.

EBGreen
+2  A: 

Looking at RFC 3330, I don't see any IPv4 address reserved for a globally non-routable address.

What I would do is assign -- in local DNS -- an unused local network IP address to the name "blackhole.<domain>" (using the appropriate domain) so you are guaranteed a stable address to which no computer will ever respond. Of course, like always when configuring DNS, ensure that no DHCP server is configured to give out the same address.

Eddie
A: 

Well, the answers given are more or less correctly. What you can do is to assign some of the special addresses that are commonly only used as net masks. These will never be encountered in the wild as IP-addresses, so are safe - as long as you don't actually try to use them in the wrong circumstances.

The best ones are:

0.0.0.0 - but be careful to not use it to open a socket, since it will then open a socket to the current main interface on the computer

255.255.255.255 - this one is never assigned, so it should be the best sentinel, unless you need to interact with netmasks.

Ola Bini
A: 

depending on what the test is you might be able to use the subnet broadcast address. i.e.

network = 192.168.1.0 /24

broadcast = 192.168.1.255

dbasnett