The other network mode a virtual machine can work in is the host-routed mode. The figure below demonstrates an example network configuration where two virtual machines, VM #1 and VM #2, are set to operate in the host-routed mode.
In this configuration:
-
Each virtual machine also has a virtual adapter exposing two interfaces: an
eth
interface in the virtual machine and avme
interface on the server. -
Unlike the bridged mode, the ARP entries for VM #1 and VM #2 are stored on the server rather than in the virtual machines themselves. The server creates these ARP entries and saves them to its ARP table when VM #1 and VM #2 start. You can use the
arp -n
command to view the current ARP entries on a server, for example:# arp -n Address HWtype HWaddress Flags Mask Iface 10.30.0.4 ether 00:1a:e2:c7:17:c1 C eth0 10.30.23.162 ether 70:71:bc:42:f6:a0 C eth0 192.168.200.201 * * MP eth0 192.168.200.202 * * MP eth0
-
Along with ARP entries, the server also creates routing entries for both virtual machines. So when the server receives a data packet destined for IP address 192.168.200.201, it knows that the packet must be forwarded to the
vme7b9a73a1
interface of VM #1. -
The server handles all incoming traffic for both virtual machines. Consider the following situation:
- Computer X on the network wants to send a data packet to VM #1 with IP address 192.168.200.201, so it issues an ARP request which computer has this IP address.
- The server replies with its own MAC address.
- Computer X sends the data packet to the indicated MAC address.
-
The
eth0
physical adapter receives the packet and routes it to thevme7b9a73a1
interface of VM #1.
-
All outgoing network traffic sent from VM #1 and VM #2 are routed through the default gateway to the
enp0s5
adapter on the server. The default gateway for host-routed virtual machines is automatically assigned the IP address of 169.255.30.1. This special IP address is taken from the Automatic Private IP Addressing (APIPA) range and used exclusively to deliver data packets from virtual machines to the server.