[SOLVED] Routing a vm traffic through an lxc?

anoo222

Member
Feb 21, 2023
41
6
8
Hello,

I have an lxc container setup with a high gain wifi dongle, which connects to a hotspot here nearby with a random mac.
I've created a virtual ethernet device on that container 'eth0:1' with an ip 192.168.1.157, and forwarded all traffic coming in to eth0:1 to the wifi dongle (wlan0).

On another container i'm running kasm workspaces (containerized apps), which is normally routed through another wireguard container if i use a containerized browser or something). However, to use tor, i wanted an extra layer of privacy, since i don't trust my vpn 100%, and i don't want to route that containerized tor through my vpn or my own connection. So i created this container with the hotspot. If i set the gateway in my kasm container to 192.168.1.157, effectively my ip is the hotspot ip.

My question is regarding using this setup with a vm, i would like to route a vm (tails for example) through that lxc aswell, but i have no idea how to do that.
Would this even be possible? If so how?

Thanks
 
I guess you can set the VM's IP address to be on the same subnet as eth0:1 (e.g., 192.168.1.158), and point the gateway to the LXC's IP (192.168.1.157). Have you tried this?

Make sure that the VM and CT are on the same bridge, e.g., (vmbr0)
 
  • Like
Reactions: anoo222
Lol i feel stupid now, i've tried this because it's the same method as my containers i forward through other containers.
I've initially tried it in a Kali VM, and it didn't work, and then posted here to ask how to do it.

After u told me again this is the way, i've tried it on Tails VM & Windows VM, working without a problem.
I tried it on the Kali VM again, but for some reason with the Kali VM it isn't working, they are on the same bridge.
I guess i have to investigate further into that kali VM what is actually the reason it isn't working.

Thanks!