Skip to content

Instantly share code, notes, and snippets.

@cryi
cryi / wrapped.md
Created August 28, 2024 21:06
Libvrt hook to bind bridged network to specific IP
  1. Create a Virtual Network with Virt Manager

    • The network name must follow this format: wrapped__@<interface to bind to>__#<IP to bind to>.
    • Set the "Forward to" option to a non-existing interface, e.g., ipvtap0. This interface will be automatically created when the network starts.
      Note: If you create multiple networks, ensure each network uses a unique interface name for the to-be-created interface.
  2. Place the Hook Script in /etc/libvirt/hooks/network.d/wrapped (the script is provided below)

    • The name of the script is not important, but make sure it is executable (chmod +x).
  3. Restart the virtnetworkd Service