[virt-tools-list] Creating a virtual NAT network
Charles Arnold
carnold at suse.com
Fri Jan 16 18:26:22 UTC 2015
We have run across the following problem when creating a Virtual Network.
On step 4 of 4 select 'Forwarding to physical network' and select the
'Destination' pop-down list. Notice that it includes the libvirt
internal node device names for the networks on the system. They are
typically named 'net_<interface name>_<mac addr>'. When selecting
these devices, virt-manager generates XML that uses the nodedev name
as shown in the following example,
<network>
<name>kvmnet1-natwlan</name>
<uuid>1388906a-b513-462c-9cea-0fc415276762</uuid>
<forward mode="nat" dev="net_wlp16s0_00_1f_3b_59_61_3d"/>
<domain name="kvmnet1natwlan"/>
<ip address="192.168.100.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.100.128" end="192.168.100.254"/>
</dhcp>
</ip>
</network>
Notice the syntax <forward mode="nat" dev="net_wlp16s0_00_1f_3b_59_61_3d"/>
The dev used here isn't really a device but rather the name of the libvirt nodedev.
When passed to libvirt it will give an error something like,
libvirtError: internal error: Failed to apply firewall rules /usr/sbin/iptables --table filter --insert FORWARD --source 192.168.100.0/24 --in-interface virbr0 --out-interface net_wlp16s0_00_1f_3b_59_61_3d --jump ACCEPT: iptables v1.4.21: interface name `net_wlp16s0_00_1f_3b_59_61_3d' must be shorter than IFNAMSIZ (15)
Try `iptables -h' or 'iptables --help' for more information.
My question is shouldn't the 'Destination' list only show real interfaces and not the libvirt nodedev names?
Assuming this is correct, a fix with a change like this would do it,
diff --git a/virtManager/createnet.py b/virtManager/createnet.py
index 6c0634c..18cadf1 100644
--- a/virtManager/createnet.py
+++ b/virtManager/createnet.py
@@ -174,7 +174,7 @@ class vmmCreateNetwork(vmmGObjectUI):
devnames = []
for nodedev in self.conn.get_nodedevs("net"):
- devnames.append(nodedev.name)
+ devnames.append(nodedev.interface)
for iface in self.conn.list_interfaces():
if iface.get_name() not in devnames:
devnames.append(iface.get_name())
- Charles
More information about the virt-tools-list
mailing list