Can you use a VPN through a virtual machine while your machine does not use the VPN?

I have a question regarding using a VPN through a virtual machine. Right now I have virtual box installed but I can switch.

What I want to do is have a Virtual Machine setup inside my main machine that is connected to a VPN, but when I browse outside of the Virtual Machine it uses my internet, but inside of the Virtual Machine uses a VPN.

Is this possible? Is there a guide to do this somewhere?

My backup plan is to connect another computer and just have that be my VPN computer, but I would rather do it the other way. So if that is possible I would like to learn how to do it.

Thank you for any help!

Yes… Just connect your VM to a VPN and that’s it.

What I want to do is have a Virtual Machine setup inside my main machine that is connected to a VPN, but when I browse outside of the Virtual Machine it uses my internet, but inside of the Virtual Machine uses a VPN.

It works exactly like that.

A guide…? Just setup the VPN on the guest machine as you would do it on your host machine. The fact that it is a virtual machine makes no difference.

ps. Know that you can not use LAN sharing between the host and guest while using the VPN without some re-routing.

Fantastic thank you.

LAN sharing between the host and guest

I’m not familiar with VM’sDoes this “LAN sharing” issue mean that downloaded files on the VPN protected VM cannot be easily / quickly accessed outside of the VM?

Thanks

Edit; the rerouting you speak of - do you have a guide? Thanks

i have linux with virtual machine that is windows

should i activate vpn in linux, or inside vm or both