I spent a lot of time trying to figure out how to have a virtual(bridged) orange0 interface to allow for a Qemu Virtual Machine to be on a virtual DMZ network and thought I would share. Below are the steps I followed that [finally] worked for me. I am now able to have an inbound firewall rule to a specific port on the virtual machine IP on orange0, while this VM on orange0 has no access to any other network(i.e. green or blue) and can only reach out to the internet via red.
I am open to suggestions as I am not a network expert and spent a lot of time interpreting the guides to achieve this setup.
1. Create orange0 Bridge by following the steps outlined in the following article and copied below:
To create “orange0” persistently at system startup, put this script as “brctl-orange0” in the /etc/init.d folder:
#!/bin/sh
set +x
. /etc/sysconfig/rc
. $rc_functions
case “${1}” in
start)
boot_mesg “Create bridge orange0…”
brctl addbr orange0
;;
stop)
boot_mesg "Destroy bridge orange0..."
brctl delbr orange0
;;
*)
echo "Usage: ${0} {start|stop}"
exit 1
;;
esac
cd to /etc/rc.d/rc3.d and run the following command to create a symlink:
ln -sf /etc/init.d/brctl-orange0 S16orange
Update the file:
/var/ipfire/ethernet/settings
with something like:
ORANGE_MODE=bridge
ORANGE_DEV=orange0
ORANGE_ADDRESS=10.0.0.1
ORANGE_NETMASK=255.255.255.0
ORANGE_NETADDRESS=10.0.0.0
RUN SETUP Again and modify to include orange0 network. This will allow for the orange0 zone to show up in the web console.
*the above setup was a bit odd as it told me it could not see the orange0 adapter, but still added it*
2. After rebooting, I then followed the below steps from the linked article below.
NOTE: One thing I had to realize was that I needed to follow the section of “You have a real NIC..” as this was created by the above steps - even though technically it is a virtual NIC && it is already in bridge mode.
Start your QEMU Command and append the following to create and connect a bridged network for the VM:
-netdev tap,id=net0,ifname=tap0,br=orange0,script=no,downscript=no \
-device virtio-net-pci,netdev=net0
Full Example that I use:
qemu -vnc :1 -hda /data/disk.img -m 4048 -cdrom /mnt/share1/disk.iso -boot c -usbdevice tablet -smp 8 -vga qxl -device AC97 -emable-kvm -netdev tap,id=net0,ifname=tap0,br=orabge0,script=no,downscript=no -device virtio-net-pci,netdev=net0 &
wait 1 after the above command and then run the following commands, which will attach the tap0 interface to the orange bridge.
ip link set tap0 master orange0
ip link set tap0 up
EDIT: moderator formatted code block