Xen – Using Netfront instead of rtl8139 on CentOS, RedHat, Fedora

On an HVM domain, the guest OS will always automatically detect your virtual network device as a buggy and slow Realtek RTL8139. You can maximize your network performance with Netfront driver which is now built into latest Redhat / CentOS kernel. For older releases, you needed the kmod-xenpv package to do this, but it’s built in as of RHEL/CentOS 5.3 I believe. The method is highly undocumented from my research so hopefully this saves someone.

1. In /etc/modprobe.conf, change 8139cp to xen-kniv using this following command:

sed -i 's/8139cp/xen-vnif/g' /etc/modprobe.conf

2. Then blacklist the rtl8139 drivers

echo 'blacklist 8139cp' >> /etc/modprobe.d/blacklist
echo 'blacklist 8139too' >> /etc/modprobe.d/blacklist

3. After a reboot, you can test that it worked by first making sure you’re online (duh!), then check lsmod and make sure you’re rid of Realtek junk at last:

lsmod | grep 8139

The output should return nothing (blank).

Now let’s activate the Xen SCSI driver to maximize disk performance by inserting the following in /etc/modprobe.conf:

alias scsi_hostadapter xen-vbd

Be sure to remove the existing scsi_hostadapter entry… if you use both, you’ll zap your disk.

Now reboot to activate.

Good luck!

3 Responses to Xen – Using Netfront instead of rtl8139 on CentOS, RedHat, Fedora

  1. […] Xen – Using Netfront instead of rtl8139 on CentOS, RedHat, Fedora … By admin | category: NetFront | tags: guest, hvm, Network, realtek, the-guest, virtual, […]

  2. Ramesh says:

    I am using RHEL 6.0, and 8139cp driver is added in the block list, but /etc/modprobe.conf is removed and I could not figure out where should I insert xen-netfornt.ko module, so that it will take this one as a PV-driver for network interfaces.

    1. Randy says:

      Centos 6 dropped support for Xen. You should be able to use PV Ops extensions in kernel instead.