title: On virt-manager I can't setup NAT
source: http://localhost:3000/c/2eda7703db219ca53de4ca495c73057f37570a4c
author:
published:
created: 2025-03-07
description: Perplexica is an AI powered chatbot that is connected to the internet.
tags:
- Network
- Computer
[
Create a NAT network using virt-manager - Linux System Engineer: Network Bonding, IPv6, Routing, and Virtual Systems Video Tutorial | LinkedIn Learning, formerly Lynda.com
1
How to do virtual networking (all types) in virt-manager? - Ask Ubuntu
askubuntu
2
libvirt: Creating a NAT Virtual Network
wiki
3
Virt-manager, a graphical user interface for managing virtual machines (VMs) using libvirt, provides an easy way to set up network interfaces for your VMs. One of the most common types of networks you might want to create is a Network Address Translation (NAT) network, which allows your VMs to access the internet while keeping their private IP addresses hidden from the public network. However, some users may encounter difficulties when trying to set up a NAT network on virt-manager. This guide will help you troubleshoot common issues and provide solutions.
Before we dive into troubleshooting, let's briefly understand what NAT networks are and how they work in the context of virt-manager.
NAT (Network Address Translation) is a method of remapping one IP address space into another by modifying network address information in the IP header of packets while they are in transit. In the case of virt-manager, a NAT network allows VMs to share the host machine's public IP address when communicating with external networks, such as the internet 12.
One common issue is interference from NetworkManager, which can prevent libvirt (and thus virt-manager) from managing network interfaces correctly 3. To resolve this:
bash sudo systemctl stop NetworkManager sudo systemctl disable NetworkManager
bash sudo systemctl enable libvirtd sudo systemctl start libvirtd
Ensure that the bridge (e.g., virbr0
) is correctly configured and active:
bash ip link show virbr0
If it doesn't exist, create a new one using nmcli
or manually configure it with bridge-utils
.bash sudo ip link set dev virbr0 up
Double-check your NAT configuration in virt-manager:
192.168.122.1
is a common choice for virt-manager's default NAT network).Check if your firewall rules are blocking necessary traffic:
bash sudo iptables -t nat -A POSTROUTING -j MASQUERADE
bash sudo firewall-cmd --permanent --zone=trusted --add-source=192.168.122.0/24 sudo firewall-cmd --reload
Ensure that you have the required kernel modules for virt-manager to work correctly:
kvm
, kvm_intel
(or kvm_amd
), and virtio
modules are loaded: bash sudo modprobe -a kvm kvm_intel virtio
When troubleshooting NAT network setup issues on virt-manager, it's essential to understand the basics of NAT networks and how they interact with libvirt and your host system. By checking common pitfalls such as NetworkManager interference, incorrect bridge configuration, and firewall rules, you should be able to resolve most NAT network setup problems.
If you're still experiencing difficulties after trying these solutions, consider seeking help from online forums or communities dedicated to virt-manager and libvirt, such as the libvirt-users mailing list or relevant subreddits (e.g., r/virtualization).