Este contenido no está disponible en el idioma seleccionado.
18.3. Network Address Translation Mode
By default, virtual network switches operate in NAT mode. They use IP masquerading rather than SNAT (Source-NAT) or DNAT (Destination-NAT). IP masquerading enables connected guests to use the host physical machine IP address for communication to any external network. By default, computers that are placed externally to the host physical machine cannot communicate to the guests inside when the virtual network switch is operating in NAT mode, as shown in the following diagram:
Figure 18.3. Virtual network switch using NAT with two guests
Warning
Virtual network switches use NAT configured by iptables rules. Editing these rules while the switch is running is not recommended, as incorrect rules may result in the switch being unable to communicate.
If the switch is not running, you can set th public IP range for forward mode NAT in order to create a port masquerading range by running:
# iptables -j SNAT --to-source [start]-[end]
18.3.1. DNS and DHCP
IP information can be assigned to guests via DHCP. A pool of addresses can be assigned to a virtual network switch for this purpose. Libvirt uses the
dnsmasq
program for this. An instance of dnsmasq is automatically configured and started by libvirt for each virtual network switch that needs it.
Figure 18.4. Virtual network switch running dnsmasq