I'm trying to get NAT networking working with libvirt/virtual-manager and
KVM on Mandriva Linux.
I installed dnsmasq (and disabled the init script, as libvirt starts up
dnsmasq manually), bridge-utils, and added MII_NOT_SUPPORTED=yes to /etc/
sysconfig/ifcfg-virbr0, otherwise Mandriva's network scripts would
immediately try to get an IP on virbr0 with DHCP, removing the correct IP
address set by libvirt on its activation.
So currently I have:
# virsh net-list --all
Name State Autostart
-----------------------------------------
default active yes
# brctl show
bridge name bridge id STP enabled interfaces
pan0 8000.000000000000 no
virbr0 8000.000000000000 yes
# ifconfig
eth0 Link encap:Ethernet HWaddr 00:21:70:AC:B0:8A
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Memory:f6ae0000-f6b00000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:9664 errors:0 dropped:0 overruns:0 frame:0
TX packets:9664 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:45094959 (43.0 MiB) TX bytes:45094959 (43.0 MiB)
virbr0 Link encap:Ethernet HWaddr EE:F4:3D:09:50:15
inet addr:192.168.122.1 Bcast:192.168.122.255
Mask:255.255.255.0
inet6 addr: fe80::ecf4:3dff:fe09:5015/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:11785 (11.5 KiB)
wlan0 Link encap:Ethernet HWaddr 00:16:EA:4C:A9:38
inet addr:192.168.100.24 Bcast:192.168.100.255
Mask:255.255.255.0
inet6 addr: fe80::216:eaff:fe4c:a938/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1496 errors:0 dropped:0 overruns:0 frame:0
TX packets:899 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:464043 (453.1 KiB) TX bytes:157558 (153.8 KiB)
wmaster0 Link encap:UNSPEC HWaddr 00-16-EA-4C-A9-38-20-
B4-00-00-00-00-00-00-00-00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp
dpt:domain
ACCEPT tcp -- anywhere anywhere tcp
dpt:domain
ACCEPT udp -- anywhere anywhere udp
dpt:bootps
ACCEPT tcp -- anywhere anywhere tcp
dpt:bootps
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere 192.168.122.0/24 state
RELATED,ESTABLISHED
ACCEPT all -- 192.168.122.0/24 anywhere
ACCEPT all -- anywhere anywhere
REJECT all -- anywhere anywhere reject-with
icmp-port-unreachable
REJECT all -- anywhere anywhere reject-with
icmp-port-unreachable
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
# ps aux | grep dnsmasq
nobody 2892 0.0 0.0 12388 920 ? S 22:26 0:00 dnsmasq
--keep-in-foreground --strict-order --bind-interfaces --pid-file --conf-
file --listen-address 192.168.122.1 --except-interface lo --dhcp-
leasefile=/var/lib/libvirt/dhcp-default.leases --dhcp-range
192.168.122.2,192.168.122.254
However, I still fail to get an IP address in my virtual machine.
In the logs, I cannot find anything problematic at first sight, libvirtd
when ran with the verbose option, continuously gives this:
Oct 19 22:45:02 defected libvirtd: EVENT: Poll got 1 event
Oct 19 22:45:02 defected libvirtd: EVENT: Dispatch 10 1 0x633040
Oct 19 22:45:02 defected libvirtd: EVENT: Remove handle 10
Oct 19 22:45:02 defected libvirtd: EVENT: mark delete 5
Oct 19 22:45:02 defected libvirtd: EVENT: Add handle 10 25 0x406e40
0x633040
Oct 19 22:45:02 defected libvirtd: EVENT: Remove handle 10
Oct 19 22:45:02 defected libvirtd: EVENT: mark delete 6
Oct 19 22:45:02 defected libvirtd: EVENT: Add handle 10 28 0x406e40
0x633040
Oct 19 22:45:02 defected libvirtd: EVENT: Calculate expiry of 0 timers
Oct 19 22:45:02 defected libvirtd: EVENT: Timeout at 0 due in -1 ms
Oct 19 22:45:02 defected libvirtd: EVENT: Poll on 6 handles 0x6574c0
timeout -1
Oct 19 22:45:02 defected libvirtd: EVENT: Poll got 1 event
Oct 19 22:45:02 defected libvirtd: EVENT: Dispatch 10 4 0x633040
Oct 19 22:45:02 defected libvirtd: EVENT: Remove handle 10
Oct 19 22:45:02 defected libvirtd: EVENT: mark delete 5
Oct 19 22:45:02 defected libvirtd: EVENT: Add handle 10 25 0x406e40
0x633040
Oct 19 22:45:02 defected libvirtd: EVENT: Calculate expiry of 0 timers
Oct 19 22:45:02 defected libvirtd: EVENT: Timeout at 0 due in -1 ms
Oct 19 22:45:02 defected libvirtd: EVENT: Poll on 6 handles 0x6574c0
timeout -1
Oct 19 22:45:02 defected libvirtd: EVENT: Poll got 1 event
Any idea what is wrong or what I should check to debug this further?
--
Frederik Himpe