Is it possible to access the host of a VM through VPN running on the VM?












0















I have an Ubuntu server running virtual machines with KVM, it has the internal IP 192.168.3.101.



I have not touched the default iptables configs on the host. The VMs use MacVTap to connect to the network.



On one virtual machine, with IP 192.168.3.108, I have installed OpenVPN. My goal is to access all machines and virtual machines from that network from outside.



On the VPN server I made sure that connections fake the local IP of the VM, by setting the POSTROUTING rule:



Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 10.8.0.0/16 anywhere


So far, my setup works well now, for one exception: I cannot access the host of the VPN server that has IP 192.168.3.101. For all attempts I get "network unreachable" and no response.



I assume that this has to be some kind of issue with the routing on the host of the VMs itself?










share|improve this question























  • If i did understand u correct: You have a VPN-Server running at 192.168.3.108. You can conncet to it using vpn. When connected you can use the tunnel to create connections to the other machines too except 192.168.3.101. The 101 machine is the host of all these VM's. If that's the case, i expect it to be a network issue that belongs to your kvm/network setup and is not openvpn related. I don't know how you need to setup MacVTap to work properly but the solution is in the MacVTap documentation for sure. Otherwise you could try using the public bridge method: linux-kvm.org/page/Networking

    – AlexOnLinux
    Feb 10 at 15:28
















0















I have an Ubuntu server running virtual machines with KVM, it has the internal IP 192.168.3.101.



I have not touched the default iptables configs on the host. The VMs use MacVTap to connect to the network.



On one virtual machine, with IP 192.168.3.108, I have installed OpenVPN. My goal is to access all machines and virtual machines from that network from outside.



On the VPN server I made sure that connections fake the local IP of the VM, by setting the POSTROUTING rule:



Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 10.8.0.0/16 anywhere


So far, my setup works well now, for one exception: I cannot access the host of the VPN server that has IP 192.168.3.101. For all attempts I get "network unreachable" and no response.



I assume that this has to be some kind of issue with the routing on the host of the VMs itself?










share|improve this question























  • If i did understand u correct: You have a VPN-Server running at 192.168.3.108. You can conncet to it using vpn. When connected you can use the tunnel to create connections to the other machines too except 192.168.3.101. The 101 machine is the host of all these VM's. If that's the case, i expect it to be a network issue that belongs to your kvm/network setup and is not openvpn related. I don't know how you need to setup MacVTap to work properly but the solution is in the MacVTap documentation for sure. Otherwise you could try using the public bridge method: linux-kvm.org/page/Networking

    – AlexOnLinux
    Feb 10 at 15:28














0












0








0








I have an Ubuntu server running virtual machines with KVM, it has the internal IP 192.168.3.101.



I have not touched the default iptables configs on the host. The VMs use MacVTap to connect to the network.



On one virtual machine, with IP 192.168.3.108, I have installed OpenVPN. My goal is to access all machines and virtual machines from that network from outside.



On the VPN server I made sure that connections fake the local IP of the VM, by setting the POSTROUTING rule:



Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 10.8.0.0/16 anywhere


So far, my setup works well now, for one exception: I cannot access the host of the VPN server that has IP 192.168.3.101. For all attempts I get "network unreachable" and no response.



I assume that this has to be some kind of issue with the routing on the host of the VMs itself?










share|improve this question














I have an Ubuntu server running virtual machines with KVM, it has the internal IP 192.168.3.101.



I have not touched the default iptables configs on the host. The VMs use MacVTap to connect to the network.



On one virtual machine, with IP 192.168.3.108, I have installed OpenVPN. My goal is to access all machines and virtual machines from that network from outside.



On the VPN server I made sure that connections fake the local IP of the VM, by setting the POSTROUTING rule:



Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 10.8.0.0/16 anywhere


So far, my setup works well now, for one exception: I cannot access the host of the VPN server that has IP 192.168.3.101. For all attempts I get "network unreachable" and no response.



I assume that this has to be some kind of issue with the routing on the host of the VMs itself?







networking server vpn iptables openvpn






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 27 at 16:48









andreasandreas

1012




1012













  • If i did understand u correct: You have a VPN-Server running at 192.168.3.108. You can conncet to it using vpn. When connected you can use the tunnel to create connections to the other machines too except 192.168.3.101. The 101 machine is the host of all these VM's. If that's the case, i expect it to be a network issue that belongs to your kvm/network setup and is not openvpn related. I don't know how you need to setup MacVTap to work properly but the solution is in the MacVTap documentation for sure. Otherwise you could try using the public bridge method: linux-kvm.org/page/Networking

    – AlexOnLinux
    Feb 10 at 15:28



















  • If i did understand u correct: You have a VPN-Server running at 192.168.3.108. You can conncet to it using vpn. When connected you can use the tunnel to create connections to the other machines too except 192.168.3.101. The 101 machine is the host of all these VM's. If that's the case, i expect it to be a network issue that belongs to your kvm/network setup and is not openvpn related. I don't know how you need to setup MacVTap to work properly but the solution is in the MacVTap documentation for sure. Otherwise you could try using the public bridge method: linux-kvm.org/page/Networking

    – AlexOnLinux
    Feb 10 at 15:28

















If i did understand u correct: You have a VPN-Server running at 192.168.3.108. You can conncet to it using vpn. When connected you can use the tunnel to create connections to the other machines too except 192.168.3.101. The 101 machine is the host of all these VM's. If that's the case, i expect it to be a network issue that belongs to your kvm/network setup and is not openvpn related. I don't know how you need to setup MacVTap to work properly but the solution is in the MacVTap documentation for sure. Otherwise you could try using the public bridge method: linux-kvm.org/page/Networking

– AlexOnLinux
Feb 10 at 15:28





If i did understand u correct: You have a VPN-Server running at 192.168.3.108. You can conncet to it using vpn. When connected you can use the tunnel to create connections to the other machines too except 192.168.3.101. The 101 machine is the host of all these VM's. If that's the case, i expect it to be a network issue that belongs to your kvm/network setup and is not openvpn related. I don't know how you need to setup MacVTap to work properly but the solution is in the MacVTap documentation for sure. Otherwise you could try using the public bridge method: linux-kvm.org/page/Networking

– AlexOnLinux
Feb 10 at 15:28










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1113320%2fis-it-possible-to-access-the-host-of-a-vm-through-vpn-running-on-the-vm%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1113320%2fis-it-possible-to-access-the-host-of-a-vm-through-vpn-running-on-the-vm%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

張江高科駅