Ayy everyone
I’m relatively new here to this forum and generally to the operating system itself.
The past few days I’ve been extensively trying to setup my system for the first time and wanted to try and run a VM machine through it out of curiosity.
I’ve managed to set up everything through the virt-manager and QEMU/KVM. I’ve also created a bridge (br01) that was connected to a TAP device (tap01), to which the VM connects to through (since my wlan driver doesn’t support bridging).
I’ve also managed and learned how to set up a DHCP server directly onto the br01 interface and set up the correct iptables for the wlan0<->tap01, and after that, everything seemed to be working perfectly fine (after a billion tries of course)
My only problem now is, I wanted to see if I could run my machine through a proxy instead, to which I’ve chosen the SOCKS5 protocol due to its (supposedly) UDP support and privacy features as well.
And I tell you, I’ve tried absolutely everything imaginable… from using redsocks directly to the br01 bridge interface (which caused me DNS issues), to trying out the tun2socks, which is my latest attempt that I’m currently trying to figure out.
I’ve tried creating another TUN interface (tun01), along with its appropriate iptables so I could have a schematics/route that would go something like this:
wlan0 ↔ tun01 ↔ tap01 ↔ br01 ↔ VM
The main idea was to manipulate and tunnel the packets using tun2socks (which it seems it only supports tun devices) through that tun01 interface.
But before starting the service, I wanted to try out and check first if the whole route works without any manipulation first.
I started the VM and everything and the connection seems to be working.
I then started up the tun2socks service on the tun01, along with the udpgw daemon that would send the the UDP packets over the SOCKS5 proxy, but I kept getting SOCKS errors nonetheless.
I’ve then tried to check absolutely everything, I quadruple checked the SOCKS5 server through netcat (nc -zv), the newly assigned tun01 ip address, I added the proper settings etc. etc., so I then decided to check the network flow just to see if anything was wrong.
I’ve used the sudo ip route show, and everything was a mess, regardless of the correct and triple checked iptables configurations. I then tried doing a test, and while I was inside my VM which was already connected to the internet, I shutdown the tun01 tun interface, and the internet was still going…
I have no idea what the hell is going on… it took me hours and hours of trying and testing and I’m kind of on the verge of giving up.
I have no idea why the iptables are not forwarding my traffic in the way I need them to, instead, I see that the VM connects to the br01 and then directly to the wlan0.
I believe it may have to do with the DHCP server or the default routes, to which if I change the default routes then my whole host system will be affected as well…
The routing so far goes as follows:
“default via (IP1) dev wlan0 proto dhcp src (IP1 with .145 in the end) metric 600 (IP2) dev tun01 proto kernel scope link src (IP2) linkdown (IP3) dev br01 proto kernel scope link src (IP1 with .145 in the end) metric 600”
Does anyone know… if there is maybe any other way I could route my whole VM’s network through a SOCKS5 proxy?
I know its more complicated than using proxychains… and I know there would be weird DNS UDP queries that somehow needs to be dealt with.
But let me know if anyone got any hands up, it would be super appreciated!
I can give you all of the commands and config I’ve used, but let me know which ones exactly, since they are so many I had to write down.
Thank ya guys.