Setting default gateway from virsh-net command line
Generally when a network is configured from virsh-define for a particular range say 192.168.4.0 it gateway will be automatically assigned to 192.168.4.1. If the gateway wants to be changed to 192.168.4.2 then it can be done by using virsh-net edit command line option from cli.
Add <route family='ipv4' address='192.168.4.0' prefix='24' gateway='192.168.4.2'/> inside the network XML.
Check the existing virsh networks:
virsh net-list
Stop the network, make configuration changes then start it:
virsh net-destroy cipher-nat2
virsh net-edit cipher-nat2
virsh net-start cipher-nat2
Related Articles
How We Set Up Our KVM Hypervisor: From Bare Metal to Production-Ready VM Host
Detailed walkthrough of building a dedicated KVM/libvirt hypervisor with XFS tuning, hugepages, 10GbE tuning, and automation.
Installing eve-ng on ubuntu 24.04 LTS
Step-by-step guide to installing EVE-NG on Ubuntu 24.04 LTS bare metal server for running network labs.
Setting default gateway from virsh-net command line
Generally when a network is configured from virsh-define for a particular range say 192.168.4.0 it gateway will be automatically assigned to 192.168.4.1.