If you’re running FreeBSD or OpenBSD in KVM and you’re having trouble with FTP traffic, the problem may be related to the way KVM handles network traffic. By default, KVM uses a network bridge to connect the virtual machine to the host network. This can cause problems with FTP traffic, as some FTP clients use “active” mode, which requires the client to connect to the server on a new port.
To resolve this issue, you can change the way that KVM handles network traffic by using a “macvtap” interface instead of a bridge. Here are the steps to do this:
- Shut down the virtual machine if it is currently running.
- Edit the XML file for the virtual machine by running the following command (replace “vm-name” with the name of your virtual machine):
virsh edit vm-name
- Find the network interface section and change the “type” to “direct” and add a “source mode” of “passthrough”:
<interface type='direct'>
<mac address='52:54:00:12:34:56'/>
<source dev='eth0' mode='passthrough'/>
</interface>
Replace “eth0” with the name of the physical network interface on the host that you want to use.
- Save the changes and exit the editor.
- Start the virtual machine by running the following command:
virsh start vm-name
After making these changes, FTP traffic should work correctly on your virtual machine.