Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.


  Search this Thread
Old 03-21-2019, 09:12 AM   #1
Registered: Aug 2018
Posts: 64

Rep: Reputation: Disabled
libvirt strategy question

Maybe I am trying to do something impossible, but I ideally want my vm's to share my vpn.

I don't think I'm getting that far though, I can't get the guest to talk with the host at all. Maybe the vpn makes it simply so that libvirt can't get to the eth interface at all?

debian os
libvirt manager gui v 1.4
no network manager
static ip from router
using vpn tun0 with 10. address

First, if there was no vpn and the default bridge never worked and I just want to add a new bridge, do I make virtmanager distribute an ip over dhcp and then bridge that address to eth0? Or routed mode?

I would prefer if my vm would get an ip from the router itself so that dhcp requests were just routed to the router. But that won't happen if the interface is in a vpn because the interface doesn't even see the router right?

Ideally libvirt would give an ip address that just routed all requests dns and otherwise out the vpn just like it was the host.

I don't get understand the transport stuff enough to know if that would ever work.

Any tips or thought appreciated thanks.
Old 04-16-2019, 12:21 PM   #2
Senior Member
Registered: Jan 2008
Distribution: Arch/Slackware/Knoppix
Posts: 1,798
Blog Entries: 14

Rep: Reputation: 279Reputation: 279Reputation: 279
Just a suggestion: get your vm communicating with the router and host like any other computer on the network first, then arrange traffic through the vpn afterwards. There are any number of tutorials in setting up networking for a vm; I use a bridge over the host adapter, with the router assigning IP addresses to host and VM independently via DHCP. A separate machine serves as the VPN host. Each machine, virtual or otherwise, then needs a vpn client.
Old 04-16-2019, 07:42 PM   #3
Senior Member
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora, Alpine, Cirros, OpenSuse/SLES
Posts: 3,085

Rep: Reputation: 809Reputation: 809Reputation: 809Reputation: 809Reputation: 809Reputation: 809Reputation: 809
Without seeing your network topology, not much can be said.

By default, libvirt sets up a bridge named virbr0, runs a DHCP server (dnsmasq) and arranges for NAT. Again by default, VMs are connected to virbr0 and get an IP address from a range like (that's the range on my PC). Thanks to NAT, they can dial out, and they can be reached from the virtualization host.

Instead of this default NAT arrangement, you can create your own bridge, plug the virtualization host's NIC into the bridge and tell libvirt to use this bridge for connecting the VMs.
Something like this:

       VM1   VM2
        |     |
      Your bridge
      The Internet
In this case, VMs are connected to the same network as that NIC, and it's your responsibility to provide an IP address to VMs, either by configuring static addresses on the VMs or by running your own DHCP server.

If you use the virtmanager wizard to create a new VM, step 5 has an option Network Selection. The attached screenshot shows the networking options on my PC; the first one, br1, is such a bridge. Virtual network 'default': NAT is virbr0.

My suggestion: Ensure that VMs can be networked at all, using NAT or your own bridge. Once you have an understanding how that works, approach the VPN question.
Attached Thumbnails
Click image for larger version

Name:	2019-04-17_093618.png
Views:	2
Size:	68.3 KB
ID:	30362  

Last edited by berndbausch; 04-16-2019 at 07:48 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Setup OpenSolaris 1002-127 PV DomU at Xen 3.4.2 & Libvirt 0.7.1-15 ( pv LXer Syndicated Linux News 0 12-02-2009 12:20 PM
LXer: Hot Hypervisor upgrade up to 3.4.2 on Xen 3.4.1 & Libvirt 0.7.1-15 Dom0 on top LXer Syndicated Linux News 0 11-28-2009 05:20 PM
LXer: Setup Xen 3.4.1 & Libvirt on top F12 Alpha (rawhide) LXer Syndicated Linux News 0 09-05-2009 08:50 PM
LXer: Setup Libvirt 0.7.0-6 & Xen 3.4.1 Dom0 on top of Fedora 11 (64-bit) LXer Syndicated Linux News 0 08-20-2009 03:30 PM
"libvirt.libvirtError: virDomainCreateLinux() failed" when virt-install sailer_sh Red Hat 0 06-15-2007 02:29 AM > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 04:06 AM.

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