LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-07-2021, 08:11 AM   #1
KahemameHa
LQ Newbie
 
Registered: Mar 2021
Posts: 1

Rep: Reputation: Disabled
how to setup virtmanager/kvm only using Host VPN


Hello first of sorry if my english isnt optimal, I just hope you understand me and can help me with my problem to solve.

I have installed openvpn with killswitch with IPTables on my hostsystem and it works very fine, when the vpn disconnects there is no connection at all besides local connections. So until here everything is fine.


Now the most work I do is from my virtual machine using kvm over virt-manager.

Now when I start a virtual machine inside kvm/virtmanager everything works like it should all connections go through the host vpn tunnel, but unfortunately the killswitch doesnt work, if the vpn disconnects or anything the connection from the virtual machine goes directly to my router and just bridges the openvpn tunnel (I use NAT) So my real IP gets exposed. I dont know where to start to fix this, every hint or help will be appreciated. If you need screens or logs or whatever just ask I will provide anything what is needed, hope you guys can help.



unfortunately Im not a pro at iptables, its a new chapter for me.

My rules are folows

# flush

sudo iptables --flush

sudo iptables --delete-chain

# Drop

sudo iptables -P OUTPUT DROP

sudo iptables -P INPUT DROP

sudo iptables -P FORWARD DROP

# Loopback

sudo iptables -A OUTPUT -j ACCEPT -o lo

sudo iptables -A INPUT -j ACCEPT -i lo

# openvpn through UDP

sudo iptables -A OUTPUT -j ACCEPT -o eth0 -p udp -m udp -m multiport --dports 1189,1190 -m state --state NEW,ESTABLISHED,RELATED

sudo iptables -A INPUT -j ACCEPT -i eth0 -p udp -m udp -m multiport --sports 1189,1190 -m state --state ESTABLISHED,RELATED

sudo iptables -A OUTPUT -j ACCEPT -o tun0

sudo iptables -A INPUT -j ACCEPT -i tun0

# private network

sudo iptables -A OUTPUT -j ACCEPT --dst 192.168.1.0/24

sudo iptables -A INPUT -j ACCEPT --src 192.168.1.0/24

#finish

ip6tables everything is on drop

thats for the general killswitch, so how and what and where can I look how to setup a killswitch for the vm/kvm
 
Old 03-12-2021, 05:35 AM   #2
Slax-Dude
Member
 
Registered: Mar 2006
Location: Valadares, V.N.Gaia, Portugal
Distribution: Slackware
Posts: 528

Rep: Reputation: 272Reputation: 272Reputation: 272
What is the network interface use to provide connectivity to the VMs?
Do you use a bridge network for the VMs?
What is the default network gateway for the host and VMs?
Are your host and VMs on a fixed IP address or are they using DHCP?
If DHCP, is the router the DHCP server or the host?

Please provide more info so someone can help you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to install KVM and VirtManager on Kali Linux LXer Syndicated Linux News 0 11-18-2020 07:20 AM
KVM, libvirt and virtmanager really slow or just me? manwichmakesameal Slackware 5 05-26-2013 09:17 AM
[SOLVED] "No KVM, No qemu-kvm" Available error while trying to install KVM on CentOS 6.3 sriramdas Linux - Virtualization and Cloud 5 01-01-2013 10:46 AM
KVM on Redhat 5.7: KVM can ping outside network, outside network can't ping KVM svandyk Linux - Networking 1 09-23-2011 06:45 AM
[Debian/Qemu/KVM] Why qemu --enable-kvm works but not kvm directly? gb2312 Linux - Virtualization and Cloud 2 03-21-2011 02:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration