Linux – slow network in centos5 VM with centos5 host running KVM

centoskvm-virtualizationlinuxnetworking

I setup KVM following the guide here:

http://www.cyberciti.biz/faq/centos-rhel-linux-kvm-virtulization-tutorial/

I setup a bridged network and it worked fine except that the transfer speed is 200KB/s instead of the gigabit speed that I get on the host machine by itself.

I tried editing the guest network settings to set "model=virtio"

http://wiki.libvirt.org/page/Virtio

but this just moves ifconfig-eth0 to ifconfig-eth0.bak in the VM and networking doesn't work at all. I tried moving ifconfig-eth0 back and starting up eth0, which works, but now the transfer speed is ~ 60KB/s

I have no idea what else to try. Any suggestions would be greatly appreciated.

Best Answer

I think you must configure iptables to allow all traffic to be forwarded across the bridge:

$ sudo iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
$ sudo service iptables save
$ sudo service iptables restart

and prevent bridged traffic from being processed by iptables rules, this improves the bridge’s performance. In /etc/sysctl.conf append the following lines:

net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0

then reload the kernel parameters configured with sysctl:

$ sudo sysctl -p /etc/sysctl.conf

and restart the libvirt daemon.

$ sudo service libvirtd reload

you can find more here Bridged networking with libvirt and I describe here the full process of How to install KVM and libvirt on CentOS 6.2 with bridged networking