-3

I'm running Kali Linux in VMware, and its IP address is 127.0.0.1 and my PC IP address is 192.168.1.5, and I can still ping my Kali Linux with my PC, shouldn't both of their IPs start with 192.168... in order to communicate with each other?

bzmind
  • 261

3 Answers3

2

127.0.0.1 is the loopback address on lo or similar and should exist on all systems.

You can infact ping any address in 127.0.0.0/8 with the exception of 127.0.0.0 & 127.255.255.255.

Bob Goddard
  • 1,482
2

127.0.0.1 is standard shorthand for "me".

It's known as the loopback address, or localhost. Every computer's 'self' can be reached at 127.0.0.1.

From Wikipedia - localhost

In computer networking, localhost is a hostname that refers to the current device used to access it. It is used to access the network services that are running on the host via the loopback network interface. Using the loopback interface bypasses any local network interface hardware.

Tetsujin
  • 50,917
1
  1. 127.0.0.1 is a loopback address, assigned to special loopback interface named lo and associated with the name localhost. This is the way to express literal "Here" for a computer. Continuing the analogy, the localhost name corresponds to "Myself", FQDN corresponds to to a full name, the hostname corresponds to a first name, and the "non-loopback" IP addresses correspond to the current position of the person inside the room, while network addresses are like room numbers.

  2. No, IP addresses don't have to be in the same network to be able to communicate. For instance, your PC is not in the same network as SuperUser server, but those are communicating somehow. In Linux, you can in principle bind a socket to any address assigned to the computer (all of them are called local addresses and you can observe them in the local routing table with ip route show table local) and communicate with any entity which has that address routed towards your computer. In particular, any two addresses present in the local table can communicate with each other, because the local table is the source of information "what's me" for a computer.