How are Hosts and Virtual machines connected? - tcp

I'm struggling to understand if the reason for a host and virtual machines connection is through the internet, if it communicates with the host as an application would communicate with the PC it is installed on or if it uses a protocol like TCP (As it purpose is to connect 2 devices so they can exchange streams of data, so it would make sense that the VM and Host were connected by this protocol).
All answers are greatly appreciated :)

As by the definition of virtual machines, they run on a hosts hardware in virtually separate areas, so the host and Virtual machines do not share virtual memory and both systems can have completely different operating systems.
This means, that those two systems are completely separate and can be connected through a variance of interfaces - for example via a network connection (TCP/IP or UDP), if host and vm are connected directly to the network.
See here an article of VMWare about Host-only-Networking without the need of the WWW.

Related

How find correct Ip for connection Client/Server Qt?

I created two Qt apps: one client and one server.
I use them to send some data for handle a remote device.
If I am in localhost I haven't issues about them, but when i search to connect them by internet i don't know how to find correct Ip server to connect Socket Client.
How i can find this ip node?
Is there a class to find It?
you cannot find it automatically, if this is what you're asking about.
In real life you would deploy your server on some publicly accessible host, give it a domain name (important part as your host can change the IP address at any time) and connect the client via the DNS domain.
However if you're just playing around and you want to show to the world that your app works, specifying the IP address of the server in your client code would be perfectly fine (assuming you're running both the server and the client in the same network).
In that case, if you're running mac/linux run the command ifconfig (or just ip depending on the distribution). On Windows you can run the command ipconfig. Both windows and linux will give you a similar output resembling this:
Pay attention to the network adapters. There can potentially be many of them. You may have some emulated adapters if you have docker or VMWare, you may have the wireless adapters if you have a WiFi card, and then the ethernet adapters if your computer can connect to the the internet with an ethernet cable. Each of these adapters specifies a different IPv4 address. You want to pick the one that is connected to the same network as your client. So for instance if both your server machine and your client running machine are connected to the same wifi, you pick the address from the Wireless LAN adapter

How to use the RJ45 tool in the CORE network emulator?

I have recently installed the CORE Network Emulator, and have already read the relevant parts of the the docs. CORE promises to be able to connect the virtual networks you create in it with physical once. However, I am having trouble connecting my virtual network to the physical one, which the RJ45 tool promises to do. From what I have read, in the CORE NetEm you can assign a network interface to the RJ45 tool, which then bridges your physical device to the network.
I have tried creating a basic topology, with one virtual host, a router, and then my computer with the RJ45 tool and I am trying to see if I can reach my computer from the host or vice versa with a ping command, but all I get is "network is unreachable."
Unfortunately, the CORE docs don't go into detail in how to use this tool and I wasn't able to find any other sources on the internet which have to do anything with it.
Here you can find the documenation: http://coreemu.github.io/core/usage.html#connecting-with-physical-networks
Does anyone have any experience with CORE and can help me out with this?
Many thanks!
The CORE RJ45 tool creates a Linux bridge between a virtual interface and a physical one.
Example: if you have node n1 linked to an RJ45 node assigned to eth0, after pressing "Start", on the underlying host you'll have a bridge with the n1:eth0 veth0 pair device and your host's eth0 device enslaved.
You'll need to configure routing between your virtual and physical networks. In the above example, suppose n1:eth0 is 10.0.0.1/24. When you plug a physical device into eth0, that device needs a route back to 10.0.0.1. That device may be on the same subnet, for example if it has the address 10.0.0.2/24. If your physical device has an address on a different subnet, you'll need to manually add a route to reach the 10.0.0.0/24 network, via the connecting interface.
I had the same problem. My CORE version is v.5.3.0 (20190615) on Ubuntu 18.04 LTS w/ Linux 5.0.0-37 generic on x86_64. Have OSPF v2, v3, Zegra, and IPForward correctly configured at r1, so that vpc1 can send and receive data successfully.
The RJ45 port of a built-in physical interface on the CORE host was mapped to a virtual endpoint for connecting the 2nd real computer, rpc 192.168.10.10/24 with a virtual switch sw1. Another virtual PC, vpc1 192.168.10.20/24 and a router r1 with 192.168.10.1/24 and 10.0.10.1/24 two interfaces.
Can ping from rpc to vpc1 and to r1 at 192.168.10.1 but not 10.0.10.1 or beyond. However, using the two-node tool or virtual terminal of vpc1, I can also traceroute and ping r1 and beyond.
The reason why the traffic of the real remote PC rpc could not be routed by r1 from 192.168.10.1 to 10.0.10.1 and back was because its WiFi was left on with the gateway configured to a FiOS router. You cannot have two gateways. Once the WiFi got turned off, the traceroute and ping can reach r1 and beyond.
This could also be the root cause of your problem.

How to use ICS with multiple VMs without losing the explictly set IP addresses for each VM's Network Interface

I am using VMware Workstation on a Windows 10 machine to add a Ubuntu Server and a Windows Server VM. This is to complete a virtual networking (firewall packet filtering) exercise using GNS3. The goal is to have 3 separate networks routed using virtual CISCO routers so I really need to have the IP of machines explicitly set to simulate different networks.
All of this is fine and I can ping from the host to the machines and the machines to the host but I'd also like to somehow be able to access Internet through each of the machines.
When I use Internet Connection Sharing and specify a single virtual adapter it warns me and changes the IP range to 192.168.137.x which is not desirable. When I want to use ICS for both VMs I create a bridged connection and apply ICS to that but again it changes my IP settings.
Is there a way I can share my hosts Internet Connection with each of the machines but keep the IP addresses and ranges I require?
Or, do I have to approach this a completely different way?
BTW, I'm using the Network Adapter type of 'Host Only' rather than Bridged or NAT as I cannot explicitly set IP addresses on those options.
I was overthinking it.
Using VMware I simply had to add an additional device Network Adapter (under VM > Settings) with a type of NAT to enable the VM to share my host's Internet. Of course, the existing interfaces (with the explicitly set IPs) were kept in place so it did not affect my virtual networking environment.

Split uplink and downlink between interfaces with openvswitch

I have one or more virtual machines on Debian host and two physical eth interfaces. I want to split bandwidth between eths (both for downlink and one for uplink). Is it possible with openvswitch and openflow?
The short answer is that it should be possible with OVS and OpenFlow. With OVS you can connect your VM's virtual ports and the server's physical interfaces.
Without thinking too much, you can load balancing the traffic by:
Installing a flow to direct any VM packet to your uplink port. This flow should rewrite the src IP and MAC as the ones from the downlink interface, so that it will look like it is being sent through that port.
Keep in mind that you might take your virtual ports configuration into account, and that you need some kind of mapping (something like NAT), to get the packets correctly returned to its respective VM. You can take a look in a NAT implementation, for the Ryu controller, to get some inspiration.

Completing a socket connection across an intranet or internet

I am writing a peer-to-peer binary socket program. There are only two endpoints. One socket is listening on my laptop system. The other socket is broadcasting from my desktop system. I have a third program running on a hosted server, that is available to broker the connection between the two. My problem is that when the laptop and desktop are on the same network, they both have the same internet IP address but different intranet IPs, but when the laptop is on the road, then the IP addresses are different. In order to be truly peer-to-peer, I have to write it so that after the connection is established, that the two computers communicate directly between one another. How is this generally accomplished, when the two computers could potentially share the same IP address, if they are running on the same network?
Your question is really: how do I deal with network address translation in a P2P system?
One possibility is to require holes poked in the NAT/firewall systems--that will ensure that requests to a given port are sent to a given computer. Allowing multiple clients inside the network would require poking multiple holes and configuring each client with the corresponding port.
Another possibility involving UDP is here--I haven't reviewed it enough to know if it really removes the broker from the equation after a handshake.
As always, Google can be your friend.

Resources