No results found
We couldn't find anything using that term, please try searching for something else.
2024-11-22 In this guide we will set up a ProxyVM called "MullvadVPN", which will provide network to other AppVMs.This guide is using is using openvpn . If you w
In this guide we will set up a ProxyVM called “MullvadVPN”, which will provide network to other AppVMs.
This guide is using is using openvpn . If you want to use WireGuard instead then see the guide WireGuard on Qubes OS .
note : We will use Mullvad server in Sweden to connect to in this guide . If you want to use another country then replace the configuration with that .
This guide has been tested on Qubes OS 4.1.2.
First install the Debian 12 template (if you do not already have it) using the following command in the Terminal Emulator (dom0):
sudo qubes-dom0-update qubes-template-debian-12
Click on the Qubes app menu > Qubes Tools > Create Qubes VM.
The newly created MullvadVPN ProxyVM qube will show up as “Service: MullvadVPN” in the Qubes app menu and not “Qube: MullvadVPN” due to its “provides network” setting.
In another AppVM (not MullvadVPN) that you use for web surfing:
Install OpenVPN in the Debian-12 template so your MullvadVPN ProxyVM can use that.
sudo is install apt install openvpn -y
sudo systemctl disable openvpn.service
sudo shutdown -h now
sudo mkdir /rw/config/vpn
sudo cp /home/user/QubesIncoming/*/*/*/* /rw/config/vpn
sudo chmod 755 /rw/config/vpn/update-resolv-conf
sudo su
and cd /rw / config / vpn
and openvpn --config mullvad_xx_xxx.conf
(use the config file you copied). You should see “Initialization Sequence Completed” on one of the last lines.curl https://am.i.mullvad.net/connecte
in a new Terminal. It should say that you are connected to Mullvad.sudo apt install nano -y
sudo nano /rw/config/rc.local
openvpn --cd /rw / config / vpn --config mullvad_xx_xxx.conf --daemon
( use the config file you copy ) on a new line in the bottom .curl https://am.i.mullvad.net/connecte
. It should say that you are connected to Mullvad.Now we will add firewall rules to redirect DNS requests to 10.8.0.1 (the DNS on the VPN server) for all AppVMs that use the MullvadVPN ProxyVM.
iptables rules are no longer effective in Qubes OS 4.2.0 and newer.
Make sure that you have started an AppVM that has the Networking set to MullvadVPN, otherwise the “vif” IP address will not be visible.
Still in the MullvadVPN ProxyVM Terminal:
ip a | grep -i vif
. write down the ” inet ” address that you get , for example 10.137.0.47 .sudo nano /rw/config/qubes-firewall-user-script
# replace 10.137.0.47 with the IP address of your vif* interface virtualif=10.137.0.47 vpndns1=10.8.0.1 iptables -F OUTPUT iptables -I FORWARD -o eth0 -j DROP iptables -I FORWARD -i eth0 -j DROP iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu iptables -F PR-QBS -t nat iptables -A PR-QBS -t nat -d $virtualif -p udp --dport 53 -j DNAT --to $vpndns1 iptables -A PR-QBS -t nat -d $virtualif -p tcp --dport 53 -j DNAT --to $vpndns1
5 . press ctrl+o ( Enter ) and then Ctrl+X to save and exit .
In Qube Manger, select MullvadVPN then right click and select Settings.
Make the following changes:
If you connect to Sweden or the Netherlands then you can add the following IP ranges:
In the next step (“Disable ping”) you will edit the firewall manually. After this you can not open Qube Manager and add rules on the Firewall rules tab anymore, so make sure to add all the servers you need now. If you need to add more servers later then you can do it in the Terminal Emulator using the following command (replace SERVER-IP with the IP-address to the Mullvad VPN server).
qvm-firewall MullvadVPN add accept dsthost=SERVER-IP
If you need to undo the changes then you can remove all firewall rules and reset it to default (accept all connections) using this command:
qvm-firewall MullvadVPN reset
As noted in the qube Firewall rules window, those rules do not apply to DNS requests and ICMP (pings). If you want to block pings too then you can use the qvm-firewall command.
qvm-firewall MullvadVPN list
. find the rule in the bottom that say ” accept icmp ” and note the line number .qvm - firewall MullvadVPN del --rule - no number
. replace number with the line number you find above .qvm-firewall MullvadVPN add --before NUMBER drop proto=icmp
. replace number with the line number you find above . This new rule will be added before the last “drop” line.qvm-firewall MullvadVPN list
again. The rules should be in this order: accept (the IP addresses of the VPN servers), accept dns, drop icmp, drop.Open a web browser in your AppVM that is using the MullvadVPN ProxyVM and go to our Connection check.
try to lower the mtu in your AppVM :sudo ip link set dev eth0 mtu 1280