<div dir="ltr"><div>Hi Daniel,</div><div><br></div><div>First of all, awfully sorry for replying so late. Unfortunately your reply had gone to the Spam drawer...</div><div><br></div><div>Also, I'm answering from Gmail's webmail which IIRC only allows for 'quote original post below'. So please forgive me for not following the proper netiquette of 'quote original post above'.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Is net.ipv4.ip_forward  set to 0 ? <br>
<br></blockquote><div><br></div><div>I assume you're asking if this is setup on the host and not on the VM's.</div><div>I've checked the host and it is configured like this:</div><div>$ sysctl net.ipv4.ip_forward<br>net.ipv4.ip_forward = 1</div><div><br></div><div>Should I change it to =0 ? It wouldn't make sense to me if I'd change it to =0 because that way IP Forwarding would be disabled and not enabled as I think enabled is what is needed in this particular case.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Also, for this to work fully, your router switch needs to know where to <br>
send traffic for the <a href="http://10.2.2.1/24" rel="noreferrer" target="_blank">10.2.2.1/24</a> network. IOW, you need to configure<br>
static routes on your router switch for 10.2.2.1<br></blockquote><div><br></div><div>I see. So, let me get this straight. What you're saying is that in order for WAN/LAN traffic to reach my VM's I need to set up static IP routes on my router - which is the default gateway for the network - to let it know how to route the packets to the VM's, which needs to be setup to go through the KVM host. Right?</div><div><br></div><div>But, for testing purposes (trying to reach the VM's from the KVM host) I don't need those static routes, right?</div><div>Because right now I'd be ok if I could reach the VM's from the KVM host and right now I can't.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I've covered a similar setup to yours here:<br>
<br>
<a href="https://www.berrange.com/posts/2009/12/13/routed-subnets-without-nat-for-libvirt-managed-virtual-machines-in-fedora/" rel="noreferrer" target="_blank">https://www.berrange.com/posts/2009/12/13/routed-subnets-without-nat-for-libvirt-managed-virtual-machines-in-fedora/</a><br>
<br></blockquote><div><br></div><div>I've looked at your article and I can see that  it resembles my setup. But I think I've got that covered.</div><div>This is what the xml file for the virtual network 'routed' looks like:</div><div><br></div><div><network><br>  <name>routed</name><br>  <uuid>970a25f7-29b6-4a6b-b890-f593eae4fc15</uuid><br>  <forward dev="wlo1" mode="route"><br>    <interface dev="wlo1"/><br>  </forward><br>  <bridge name="virbr2" stp="on" delay="0"/><br>  <mac address="52:54:00:bf:35:42"/><br>  <domain name="routed"/><br>  <ip address="10.2.2.1" netmask="255.255.255.0"><br>    <dhcp><br>      <range start="10.2.2.11" end="10.11.22.254"/><br>    </dhcp><br>  </ip><br></network></div><div><br></div><div>I've got this 'routed' network in use for the virtual nic of my VM's.</div><div>Weird this is, when I run a net-list command, it comes back empty...<br></div><div><br></div><div>$ virsh net-list <br> Name   State   Autostart   Persistent<br>----------------------------------------<br><br>$ </div><div><br></div><div>This doesn't look ok, right? I mean, running a net-list command it should list all the networks I have set up on this server. But it's coming back empty as if there weren't any networks. I've double checked on Virtual Machine Manager and both the 'default' and 'routed' networks are active and are set up to 'auto start on boot'.</div><div>Could this somehow be related to my problem? I guess not because the 'default' network is the NAT network that I've used before and it worked and still works when I set the VM's to use it.</div><div>I'm puzzled with this stuff.</div><div>Hope you or someone else can put me back on the right track.</div><div>Thanks in advance.</div><div><br></div><div>Cheers,</div><div><br></div><div>Rui Correia<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 20, 2020 at 10:32 AM Daniel P. Berrange <<a href="mailto:dan@berrange.com" target="_blank">dan@berrange.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, Jul 19, 2020 at 11:54:06AM +0100, Rui Correia wrote:<br>
> Greetings folks.<br>
> I've setup libvirtd on my manjaro linux laptop.<br>
> Got a couple of VM's running (Win10 and Debian10) through NAT without any<br>
> issues.<br>
> <br>
> This is what the current network diagram looks like and it works fine:<br>
> <br>
>                            +-----------------------------------+<br>
>                            |           +---------------------+ |<br>
>                            |           |     +----------+    | |<br>
>                            |           |     |Win 10 VM |    | |<br>
>                            |           |     |10.1.1.10 |    | |<br>
>                            |           |     +----------+    | |<br>
>                            | Laptop    |                     | |<br>
>                            | Manjaro   |     +-------------+ | |<br>
>                            | 10.0.0.10 |     |Debian 10 VM | | |<br>
>                  +-------->+           |     |10.1.1.11    | | |<br>
>                  |         |           |     +-------------+ | |<br>
>                  |         |           |NAT                  | |<br>
>                  |         |           |<a href="http://10.1.1.0/24" rel="noreferrer" target="_blank">10.1.1.0/24</a>          | |<br>
>                  |         |           +---------------------+ |<br>
> +------------+   |         +-----------------------------------+<br>
> |router      |   |<br>
> |switch      +---+<br>
> |<a href="http://10.0.0.0/24" rel="noreferrer" target="_blank">10.0.0.0/24</a> |   |         +---------+<br>
> +------------+   |         |Desktop  |<br>
>                  +-------->+Manjaro  |<br>
>                            |10.0.0.11|<br>
>                            +---------+<br>
> <br>
> But now I need the debian machine to be accessible from another host on the<br>
> lan <a href="http://10.0.0.0/24" rel="noreferrer" target="_blank">10.0.0.0/24</a> which of course is outside the host.<br>
> That network diagram would look like this:<br>
> <br>
>                            +-----------------------------------------+<br>
>                            |              +------------------+       |<br>
>                            |              |     +----------+ |       |<br>
>                            |              |     |Win 10 VM | |       |<br>
>                            |              |     |10.1.1.10 | |       |<br>
>                            |              | NAT +----------+ |       |<br>
>                            |              | <a href="http://10.1.1.0/24" rel="noreferrer" target="_blank">10.1.1.0/24</a>      |       |<br>
>                            |              +------------------+       |<br>
>                            |  Laptop                                 |<br>
>                  +-------->+  Manjaro     +------------------------+ |<br>
>                  |         |  10.0.0.10   |        +-------------+ | |<br>
>                  |         |              |        |Debian 10 VM | | |<br>
>                  |         |              |        |10.2.2.10    | | |<br>
>                  |         |              | Routed +-------------+ | |<br>
> +------------+   |         |              | <a href="http://10.2.2.0/24" rel="noreferrer" target="_blank">10.2.2.0/24</a>            | |<br>
> |router      |   |         |              +------------------------+ |<br>
> |switch      +---+         +-----------------------------------------+<br>
> |<a href="http://10.0.0.0/24" rel="noreferrer" target="_blank">10.0.0.0/24</a> |   |<br>
> +------------+   |<br>
>                  |<br>
>                  |         +---------+<br>
>                  |         |Desktop  |<br>
>                  +-------->+Manjaro  |<br>
>                            |10.0.0.11|<br>
>                            +---------+<br>
> <br>
> <br>
> So, I've setup a 'routed network' for the Debian 10 VM but it's not working<br>
> as I would expect.<br>
> The host can ping the Debian VM and the Debian VM can ping the host but the<br>
> Debian VM cannot ping the router 10.0.0.1 or any ip address on the internet.<br>
> I've been using Virtual Machine Manager to set everything up.<br>
> And this is how the routed network is configured<br>
> <network connections="1"><br>
>   <name>routed</name><br>
>   <uuid>970a25f7-29b6-4a6b-b890-f593eae4fc15</uuid><br>
>   <forward dev="wlo1" mode="route"><br>
>     <interface dev="wlo1"/><br>
>   </forward><br>
>   <bridge name="virbr2" stp="on" delay="0"/><br>
>   <mac address="52:54:00:bf:35:42"/><br>
>   <domain name="routed"/><br>
>   <ip address="10.2.2.1" netmask="255.255.255.0"><br>
>     <dhcp><br>
>       <range start="10.2.2.2" end="10.2.2.254"/><br>
>     </dhcp><br>
>   </ip><br>
> </network><br>
> <br>
> Any idea on what i might be doing wrong?<br>
<br>
Is net.ipv4.ip_forward  set to 0 ? <br>
<br>
<br>
Also, for this to work fully, your router switch needs to know where to <br>
send traffic for the <a href="http://10.2.2.1/24" rel="noreferrer" target="_blank">10.2.2.1/24</a> network. IOW, you need to configure<br>
static routes on your router switch for 10.2.2.1<br>
<br>
I've covered a similar setup to yours here:<br>
<br>
<a href="https://www.berrange.com/posts/2009/12/13/routed-subnets-without-nat-for-libvirt-managed-virtual-machines-in-fedora/" rel="noreferrer" target="_blank">https://www.berrange.com/posts/2009/12/13/routed-subnets-without-nat-for-libvirt-managed-virtual-machines-in-fedora/</a><br>
<br>
<br>
<br>
Regards,<br>
Daniel<br>
--<br>
|: <a href="https://berrange.com" rel="noreferrer" target="_blank">https://berrange.com</a>      -o-    <a href="https://www.flickr.com/photos/dberrange" rel="noreferrer" target="_blank">https://www.flickr.com/photos/dberrange</a> :|<br>
|: <a href="https://libvirt.org" rel="noreferrer" target="_blank">https://libvirt.org</a>         -o-            <a href="https://fstop138.berrange.com" rel="noreferrer" target="_blank">https://fstop138.berrange.com</a> :|<br>
|: <a href="https://entangle-photo.org" rel="noreferrer" target="_blank">https://entangle-photo.org</a>    -o-    <a href="https://www.instagram.com/dberrange" rel="noreferrer" target="_blank">https://www.instagram.com/dberrange</a> :|<br>
<br>
</blockquote></div>