Why was "10.0.2.2" not with the launch of "ifconfig"?

As you know, I use vagrant to control a single vm, when I enter vm with vagrant ssh , the output shows that I was login with 10.0.2.2. So this IP was my host IP. But why can't I see it when running ifconfig in my host? It confused me. (But I can find the entry for 10.0.2.2 in the host route table)

Any hint would be appreciated!

+5
source share
1 answer

10.0.2.2 always points to the local host when starting the emulator or vm. Thus, in the virtual machine, it refers to the local host (127.0.0.1) as 10.0.2.2. It is for this reason that you cannot see this in ifconfig on your host.
You can find more information in this thread.

+8
source

Source: https://habr.com/ru/post/1236221/


All Articles