(added users(a)lists.libvirt.org back into the Cc so that anyone else
asking the same question in the future will benefit from the answer)
On 3/28/25 8:12 AM, James Liu wrote:
Hi Laine,
I tried your first solution but somehow it didn't work(the network is
NAT). I edited the xml in virt-manager gui. Whenever I added following
options, and click "Apply", the virt-manager will revert(remove) the
"alias" tag; consequently, the qemu command line couldn't find the
device name('foo' in this example).
Sorry, I had meant to point this out but somehow forgot - user-specified
aliases must begin with "ua-", otherwise they will be ignored. So
instead of using "<alias name='foo'/>", use "<alias
name='ua-foo'/>"
(and then in the <qemu:arg value> use "netdev=hostua-foo")
Also note that your guest should be shutdown while you're making these
changes.
Appreciate your suggestions.
<interface type="network">
<mac address="52:54:00:3a:bf:52"/>
<source network="default"/>
<model type="e1000e"/>
<alias name="*foo*"/> # virt-manager will always remove
this tag
<address type="pci" domain="0x0000" bus="0x01"
slot="0x00"
function="0x0"/>
</interface>
<qemu:commandline>
<qemu:arg value="-object"/>
<qemu:arg
value="filter-dump,id=f1,netdev=*foo*,file=/tmp/xyzzy.pcap"/>
</qemu:commandline>