Your machine has an address
Print the LAN IP. Place it in an RFC 1918 block. 127.0.0.1 is this computer.
You will be able to
- Print your machine's LAN IPv4 address with
ip -4 addron Linux or WSL, oripconfig getifaddron a Mac. - Place a given address in one of RFC 1918's three private blocks:
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16. - Say what
127.0.0.1means, and why a192.168.x.xaddress stops at your network.
~/projects/first-site/index.html is already on disk.
Do not open it. Do not edit it. The page can wait.
This topic is about the machine that holds the file, not the file.
Open a terminal. Type this and press Enter:
ip -4 addr
A list of interfaces appears. An interface is a named connection the machine uses to talk on a network.
One line will look exactly like this:
inet 127.0.0.1/8 scope host lo
Click any piece of the line.
inet127.0.0.18/8 means the whole 127.0.0.0/8 block is loopback, not only .1.scope hostlolo is the loopback interface. It is never the LAN address.127.0.0.1 and lo, it is not the address you write down.That line is loopback. Loopback is this computer talking to itself.
The address is 127.0.0.1. The /8 means the whole 127.0.0.0/8 block is loopback, not only .1.
scope host and lo mark it as this host only. Loopback must not appear outside a host.
So this is not the address you write down.
Scan the rest of the listing. Each inet line sits under an interface name.
lo is loopback. Skip it.
Find an inet line that is not 127.0.0.1.
The four dotted numbers after inet are this machine’s LAN address.
A LAN is a local area network: the machines that share your Wi-Fi.
The -4 keeps the list to IPv4. Write that address down. You will need it later.
On a Mac. There is no
ipcommand. First runnetworksetup -listallhardwareports. Find the device name next to Wi-Fi — it is not alwaysen0. Then runipconfig getifaddrwith that name. Empty output means the wrong interface, not a missing network.
On Windows / WSL. Run the same
ip -4 addrinside your Ubuntu terminal.
Four numbers
An IPv4 address is four octets. An octet is eight bits. Four of them make 32 bits in total.
They are written with dots, like 192.168.1.42.
That shape is a documented example, not a capture from this machine. Your numbers will differ.
Every machine on the Wi-Fi has one of these. They are private addresses.
A private address is one that anyone may use on their own network. You do not register it first.
These three ranges are the RFC 1918 private blocks. RFC 1918 is just the name of that reservation.
| Block | Addresses that belong |
|---|---|
10.0.0.0/8 | 10.0.0.0–10.255.255.255 |
172.16.0.0/12 | 172.16.0.0–172.31.255.255 |
192.168.0.0/16 | 192.168.0.0–192.168.255.255 |
These numbers are not unique on the internet. Another network may use the same four octets.
They only have to be unique on your LAN.
Read the first number of the address you wrote down.
If it is 10, the address sits in 10.0.0.0/8.
If the first two numbers are 192.168, it sits in 192.168.0.0/16.
The middle block is the trap. 172 is not enough.
The second number must sit between 16 and 31.
172.16.0.0 through 172.31.255.255 is private. A 172 with any other second number is not.
Try a shape. 10.0.0.5 starts with 10, so it is 10.0.0.0/8.
192.168.1.42 starts with 192.168, so it is 192.168.0.0/16.
Now classify yours. Tick one of the three rows.
Write the block next to the address. You need both later.
If the number you wrote is 127.0.0.1, you copied the loopback line. Look at the listing again.
If you see more than one other inet line, pick the interface you are actually using.
This computer, or the network
127.0.0.1 means this computer talking to itself.
Nothing on the Wi-Fi can use it. It never leaves the machine.
A 192.168 address is the opposite kind of local. Other machines on your network can send to it.
It still stops at your network. A private address is not reachable from the public internet.
When traffic goes out, the router rewrites the private address. That rewrite is NAT. We stop there.
127.0.0.1 versus a 192.168 address127.0.0.1 | 192.168.x.x | |
|---|---|---|
| Who can use it | Only this computer. It is loopback. | Any machine on your local network. |
| Does it leave the machine | No. Loopback must not appear outside a host. | Yes, on the local network. It still stops at your router. |
127.0.0.1 never leaves this computer. A 192.168 address is for the local network, not the public internet.The same wall applies to a 10. address and to a 172.16–31. address. Private means local.
Keep the number
You have not touched index.html. The file is still in ~/projects/first-site.
What changed is what you know about the machine that holds it.
You printed its LAN address. You placed that address in one of the three private blocks.
Copy the number somewhere you will not lose it.
Do not copy 127.0.0.1. If that is what you have on paper, run the command again.
Next you will look at the doors on that address. An address names the machine. Something still has to be listening.
Flashcards
Linux command that prints this machine's IPv4 addresses.
ip -4 addr. On WSL, run the same command inside Ubuntu.
You ran ip -4 addr. Which inet line do you write down?
The one that is not 127.0.0.1. That other number is the LAN address.
127.0.0.1
This computer talking to itself. The whole 127.0.0.0/8 block is loopback and must not appear outside a host.
10.0.0.0/8
Private block 10.0.0.0–10.255.255.255. First number is 10.
172.16.0.0/12
Private block 172.16.0.0–172.31.255.255. A first number of 172 is not enough — the second must sit between 16 and 31.
Quiz
Show answer
Answer: False
The opposite is true. That line is loopback: this computer talking to itself. scope host and lo mark it as this host only, and loopback must not appear outside a host. The LAN address is a different inet line — one that is not 127.0.0.1. Write that other number down (objectives 1, 3).
The opposite is true. That line is loopback: this computer talking to itself. scope host and lo mark it as this host only, and loopback must not appear outside a host. The LAN address is a different inet line — one that is not 127.0.0.1. Write that other number down (objectives 1, 3).
Show answer
Answer:
127.0.0.1 is loopback: this computer talking to itself. It must not appear outside a host, so it is not a Wi-Fi address. A 192.168.x.x address is private — it sits in 192.168.0.0/16. Anyone may use that block on their own network, with no public registration, so the number is not unique on the internet and is not reachable from outside. Traffic that leaves is rewritten by the router.
A full-credit answer shows: A strong answer covers (1) that 127.0.0.1 means this computer talking to itself and must not leave the host, and (2) that a 192.168 address is private — usable on the local network, not reachable from the public internet — so it stops at the router.
127.0.0.1 is this computer talking to itself; the whole 127.0.0.0/8 block is loopback and must not leave the host. A 192.168.x.x address is in 192.168.0.0/16, one of the three private blocks anyone may use without registration. Those numbers are for the local network only, so they stop at the router. An answer that treats 127.0.0.1 as the Wi-Fi address, or that treats 192.168 as publicly reachable, has swapped the two kinds of local (objective 3).
Sample answer
127.0.0.1 is loopback: this computer talking to itself. It must not appear outside a host, so it is not a Wi-Fi address. A 192.168.x.x address is private — it sits in 192.168.0.0/16. Anyone may use that block on their own network, with no public registration, so the number is not unique on the internet and is not reachable from outside. Traffic that leaves is rewritten by the router.
A full-credit answer shows
A strong answer covers (1) that 127.0.0.1 means this computer talking to itself and must not leave the host, and (2) that a 192.168 address is private — usable on the local network, not reachable from the public internet — so it stops at the router.
127.0.0.1 is this computer talking to itself; the whole 127.0.0.0/8 block is loopback and must not leave the host. A 192.168.x.x address is in 192.168.0.0/16, one of the three private blocks anyone may use without registration. Those numbers are for the local network only, so they stop at the router. An answer that treats 127.0.0.1 as the Wi-Fi address, or that treats 192.168 as publicly reachable, has swapped the two kinds of local (objective 3).
Show answer
Answer: 10.0.0.0/8
10.0.0.5 starts with 10, so it sits in 10.0.0.0/8 (10.0.0.0–10.255.255.255). 172.16.0.0/12 needs a first number of 172 and a second number from 16 to 31. 192.168.0.0/16 needs the first two numbers to be 192.168. 127.0.0.0/8 is loopback, not a private LAN block — 10.0.0.5 is not this computer talking to itself (objective 2).
10.0.0.5 starts with 10, so it sits in 10.0.0.0/8 (10.0.0.0–10.255.255.255). 172.16.0.0/12 needs a first number of 172 and a second number from 16 to 31. 192.168.0.0/16 needs the first two numbers to be 192.168. 127.0.0.0/8 is loopback, not a private LAN block — 10.0.0.5 is not this computer talking to itself (objective 2).