example.com is OK for domain example, what is example IP Address?

Network ProgrammingIp Address

Network Programming Problem Overview


We use the example.com often for domain name reference. I wonder if any IP address used as an example IP address to mention in references like tutorial or notes?. I knew the loop back interface 127.0.0.1 can be used but it has been known for local system always.

Can example.com IP Address used for this purpose legally?

Network Programming Solutions


Solution 1 - Network Programming

> The blocks 192.0.2.0/24 (TEST-NET-1), > 198.51.100.0/24 (TEST-NET-2), and 203.0.113.0/24 (TEST-NET-3) are provided for use in documentation.

From rfc5737

Solution 2 - Network Programming

There is no law against (ab)using someone elses domain or IP address in examples, but it is a very bad idea. As some uses will use your example values verbatim.
For example, the IP address 1.2.3.4 have been used in examples. But that is live real IPv4 addresses that are used in 1/8 as valid global IPv4-prefix. There are already some concerns about this use of that address in examples.

RFC5737 is about IPv4 addresses used for examples, which are any address in networks 192.0.2.0/24 (TEST-NET-1), 198.51.100.0/24 (TEST-NET-2) and 203.0.113.0/24 (TEST-NET-3), like 192.0.2.10, 198.51.100.3 or 203.0.113.254. These doesn't exist on Internet.

> Three IPv4 unicast address blocks are reserved for use in examples in specifications and other documents. This document describes the use of these blocks.

RFC3849 is about IPv6 addresses used for examples, which are any address in 2001:db8::/32. These are are also not used on Internet.

> The document describes the use of the IPv6 address prefix 2001:DB8::/32 as a reserved prefix for use in documentation.

RFC2606 is about reserved TLD:s for different use. Those are ".test", ".example", ".invalid" and "localhost". Any domain under those can be used, like "a-host.example"
"test" is used for testing, "example" for documentation, "invalid" in configuration files that needs to be tweeked and "localhost" for 127/8 (mostly 127.0.0.1). There are also three reserved second level domains to be used for example domains (example.com, example.net and example.org).

> To reduce the likelihood of conflict and confusion, a few top level domain names are reserved for use in private testing, as examples in documentation, and the like. In addition, a few second level domain names reserved for use as examples are documented.

RFC1918 is about the private network addresses 10/8, 172.16/12 and 192.168/16. Those are private and should not exist on Internet, so they might be used for example networks. But it's better to use the other reserved IP addresses mentioned above, as they will not conflict with real private network use in users LAN setup.

> This document describes address allocation for private internets. The allocation permits full network layer connectivity among all hosts inside an enterprise as well as among all public hosts of different enterprises.

RFC3330 should be of interest as an overview of all special IPv4 networks.

> This document describes the global and other specialized IPv4 address blocks that have been assigned by the Internet Assigned Numbers Authority (IANA).

Solution 3 - Network Programming

> Can example.com IP Address used for this purpose legally?

Any IP address can be used as an example legally - there's no law that would prevent you from doing that. Using one of the private ranges or an invalid one (making any of the four numbers greater than 255) will prevent anyone accidentally flooding someone's IP with an infinite loop or something based off your examples.

Solution 4 - Network Programming

If you are just using it for an example in documentation, pick an IP address that isn't technically valid (like 192.168.0.256). It still conveys the point, but you don't have to worry about it being in use.

Solution 5 - Network Programming

I'd use one of the private ranges, e.g. 192.168.1.1. I wouldn't use anyone's public IP space.

Solution 6 - Network Programming

This would have similar use to the phone numbers in movies starting with 555-...

IP 1.2.3.4 appears to be too synthetic. Maybe you can use www.icann.org ( 192.0.32.7 ), or tempuri.org ( 207.46.197.32 ).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser90150View Question on Stackoverflow
Solution 1 - Network ProgrammingnosView Answer on Stackoverflow
Solution 2 - Network ProgrammingAndersView Answer on Stackoverflow
Solution 3 - Network ProgrammingceejayozView Answer on Stackoverflow
Solution 4 - Network ProgrammingbtaView Answer on Stackoverflow
Solution 5 - Network ProgrammingJoeView Answer on Stackoverflow
Solution 6 - Network ProgrammingJohn AlexiouView Answer on Stackoverflow