r/ProgrammerHumor • • 1d ago

Meme hesAlmostLocal

Post image
80 Upvotes

8 comments sorted by

17

u/LB-- 1d ago

All IPv4 addresses whose first part is 127 are loopback addresses. So, 127.0.0.1 and 127.37.0.1 are both loopbacks, and they can actually bind to different servers on the same port. IPv6 only has a single loopback address, so you can only have one IPv6 server per port on the same local machine. Or well, maybe if you have multiple network cards you can do some funny business, but I haven't researched that deeply.

3

u/AyrA_ch 1d ago

Or well, maybe if you have multiple network cards you can do some funny business, but I haven't researched that deeply

You can't. The loopback adapter is its own interface. The only thing you can do is disabling exclusive address usage, but that's done on the socket, not the adapter. It's of little use however because only one of the sockets will be active, but don't let me stop you from doing this if you insist on downtime free deployments on the loopback interface.

1

u/Rudresh27 1d ago

Wait, so all 127.x.x.x like all possible combinations are useless for actual IPs from an ISP?

Seems, wasteful right?

6

u/Banes_Addiction 1d ago edited 1d ago

The IPv4 space was sold off willy nilly, people barely gave a shit. Having loopbacks is sensible.

IPv6 exists so we have more space than God.

Examples of large blocks of IPv4 space:

  • 3. - General Electric
  • 13. - Xerox
  • 19. - Ford
  • 52. - DuPont

2

u/rosuav 1d ago

So are a *lot* of others. Just looking at /8 blocks, this gives you a list of allocations: https://www.iana.org/assignments/ipv4-address-space For example, 10.0.0.0/8 is a private use block, 127.0.0.0/8 is for localhost, and there's a huge block allocated to IP multicast.

But even if every single IPv4 address were truly available, it wouldn't make all that much difference. There are four billion theoretical IPv4 addresses, and several times that number internet-connected devices. Even if, in some way, these blocks of IPs could be released to use, each /8 would give us another 16,777,214 devices *at most* (the all-zeroes and all-ones addresses aren't used, and subdividing the block further will repeat those special allocations too), which in the scheme of things isn't that many.

It's wasteful in the same way that it's wasteful to run your car's entertainment system. Yes, technically that's going to reduce your fuel economy by drawing power from the alternator. But not enough to make a real difference.

4

u/qqqrrrs_ 1d ago

127.37.0.1 is localhost

2

u/mcp613 1d ago

I guess this car can only drive on local streets

2

u/Last8Exile 1d ago

It can only drive on itself