Skip to content

Networks ​

Commands for managing libvirt virtual networks — listing, inspecting, creating, activating, deactivating, and deleting networks that VMs can attach to.

ls ​

List all libvirt networks managed by the daemon, showing name, UUID, active state, persistence, autostart, mode, bridge, subnet, and gateway.

bash
vmr network ls

Examples ​

bash
vmr network ls

inspect ​

Show detailed information about a specific network.

bash
vmr network inspect <NAME>

Arguments ​

ArgumentDescription
NAMEName of the network to inspect

Output Fields ​

FieldDescription
NameNetwork name
UUIDLibvirt UUID
ActiveWhether the network is currently active
PersistentWhether the network persists across daemon restarts
AutostartWhether the network starts automatically on host boot
ModeNetwork mode (nat, isolated, routed, bridge, open)
BridgeHost bridge interface name
SubnetNetwork subnet in CIDR notation
GatewayGateway IP address
DHCP StartStart of the DHCP range
DHCP EndEnd of the DHCP range

Examples ​

bash
vmr network inspect my-network

create ​

Create a new libvirt virtual network with the specified configuration.

bash
vmr network create <NAME> [OPTIONS]

Arguments ​

ArgumentDescription
NAMEName for the new network

Options ​

FlagShortDescription
--mode <MODE>-mNetwork mode: nat, isolated, routed, bridge, or open (default: nat)
--subnet <CIDR>Subnet in CIDR notation (e.g., 192.168.100.0/24)
--gateway <IP>Gateway IP address (e.g., 192.168.100.1)
--dhcp-start <IP>Start of the DHCP address range
--dhcp-end <IP>End of the DHCP address range
--bridge <NAME>Host bridge interface name
--autostartAutomatically start the network on host boot

Network Modes ​

ModeDescription
natNAT with host masquerade — guests can reach external networks through the host (default)
isolatedIsolated network with no external connectivity — guests can only communicate with each other
routedRouted network with static routes — no NAT, requires external routing configuration
bridgeBridged to an existing host bridge interface — guests appear on the host's physical network
openOpen/unrestricted forwarding — no firewall rules are applied

TIP

macvtap networks are not created with vmr network create, but they can be declared inside a VMCompose file's networks section using mode: macvtap and a parentDev.

Examples ​

bash
vmr network create my-nat-network \
  --mode nat \
  --subnet 192.168.100.0/24 \
  --gateway 192.168.100.1 \
  --dhcp-start 192.168.100.100 \
  --dhcp-end 192.168.100.254

vmr network create my-isolated-network \
  --mode isolated \
  --subnet 10.10.0.0/24 \
  --gateway 10.10.0.1 \
  --autostart

vmr network create my-bridge-network \
  --mode bridge \
  --bridge br0

TIP

For bridge mode, the host bridge interface must already exist.

activate ​

Activate a previously defined but inactive network. VMs can only attach to active networks.

bash
vmr network activate <NAME>

Arguments ​

ArgumentDescription
NAMEName of the network to activate

Examples ​

bash
vmr network activate my-network

deactivate ​

Deactivate a running network. VMs currently attached to the network may lose connectivity.

bash
vmr network deactivate <NAME>

Arguments ​

ArgumentDescription
NAMEName of the network to deactivate

Examples ​

bash
vmr network deactivate my-network

WARNING

Deactivating a network does not detach VMs that are currently using it. Running VMs attached to the network will lose their network interface connectivity. Stop or migrate affected VMs first.

remove ​

Delete a network definition. The network must be inactive unless --force is specified, in which case it is deactivated and then deleted.

bash
vmr network remove <NAME> [OPTIONS]

Arguments ​

ArgumentDescription
NAMEName of the network to remove

Options ​

FlagShortDescription
--force-fForce removal — deactivate the network if it is currently active

Examples ​

bash
vmr network remove my-network

vmr network remove my-network -f

Built with Go and Rust