How request over internet are handled when VMs have same IP address?

2

All the VMs including the host computer has the same IP address when connected to the internet (I am using Bridged Adapter).Then how are request handled by the web and our web browser.

what I mean to ask is suppose we request facebook from all of our VMs and host machine and login into different accounts. From what I have seen all the requests are handled properly.
Don't they get confused when all the machine have the same IP? Or is it due to the fact that in Bridged mode all VMs act as separate node as explained here.
If that is the then why don't they have a different IP address? (these are conditions when I connect to the Internet via PSK WiFi)
When I try to connect via captive portal ISP allows only one machine at a time to connect to the internet and another machine automatically gets logged out. Why is it so? When all the VMs are supposed to have the same IP address.

neferpitou

Posted 2017-02-02T18:55:29.737

Reputation: 123

I'm not entirely sure what you are saying about the ISP captive portal, but it sounds like that interface is on the far side of your router. Your host and VMs have their own differant IPs if you are using bridged and it is working correctly, but your public IP address is likely the same for all of them, because your router is performing NAT. so each NIC has its own LAN address, but when viewed from the WAN, all of them appear to be the same public address. – Frank Thomas – 2017-02-02T20:44:07.250

Suppose I am connected to the web through my host PC. During this time if I try connecting from VMs to the internet, the web page again takes me to captive portal and if I login internet connection from host gets disconnected. Thanx for your explanation . – neferpitou – 2017-02-02T20:51:00.677

thats your ISP doing somthing messed up. Are you on a wireless ISP? have they modifiedd your browser with a proxy server or somesuch? – Frank Thomas – 2017-02-02T21:09:02.990

1@user666887 When you have bridged mode connected directly to the modem, it views it the same as if you have multiple PCs connected to the modem with a switch or hub. Your ISP only allows a single device to connect to the Internet at a time. Each VM has a unique MAC address, and when the modem detects a connection from a different MAC than the one it gave the IP to, it routes you to the captive portal. – Barmar – 2017-02-02T22:23:45.753

This is why you need to use a router. Then the modem only sees the router's MAC, not the MAC's of the PC or VMs. The router performs NAT, just like if you have multiple PCs connected to it. – Barmar – 2017-02-02T22:25:51.767

@Barmar from what you have explained if I spoof one of my mac address to another then two users can be logged in as they have the same mac address. – neferpitou – 2017-02-03T07:54:15.457

Yes, but then you'll run into other problems, because reply packets will go to both VMs. The one that didn't send the original connection request will then reset the connection. – Barmar – 2017-02-03T16:43:16.450

Answers

3

There are a couple things at play. First, Facebook and other websites typically establish login sessions based on information held in a cookie that is specific to the user, browser, PC, etc. You can login to FB using Chrome & IE as two separate users - no issue.

Secondly, your bridged VM connections have their own IPs on the LAN side and are behind a NAT firewall. They have the same IP on the WAN and the firewall tracks where traffic is originating and ensures sessions are established with the correct requester. What you are seeing is the result that the firewall is presenting all the traffic from a single IP on the internet/WAN side.

uSlackr

Posted 2017-02-02T18:55:29.737

Reputation: 8 755

thanx, I was completely ignoring cookies and was focused on same IP :P – neferpitou – 2017-02-03T07:55:29.303

1@user666887 Don't forget about port numbers, too. When the NAT router forwards connections, it often needs to change port numbers to make them unique for different clients. – Barmar – 2017-02-03T16:41:55.597