On 11/22/2016 02:09 PM, Marcelo Palma wrote:
Hi guys, I  describe the context of the problem below:

I installed a Tor relay on a virtual machine on my server with IP 9.1.1.101. This virtual machine needs to use a static IP (9.1.1.102) to work as a Tor relay. After that I create a virtual network in Routed mode to connect to the physical network (used as a bridge between the virtual machine and the external network (Internet)).

Since I change the NAT to Routed mode, I can't access my server via ssh user@9.1.1.101.

First let's make sure we're talking about the same things. Here is what I *think* you're describing:

* Previously you had a virtual machine (I'll use the word "guest") that was connected to a <forward mode='nat'> libvirt network, and the you were able to connect to the physical machine (I'll call it "host") with "ssh user@[some IP address]".

* Now you have created a libvirt network with <forward mode='route'>, and given the guest the IP address 9.1.1.102. One of the host's interfaces is 9.1.1.101, and "ssh user@9.1.1.101" doesn't connect.

If that's all correct, then here are my questions:

What is the IP address and netmask (or prefix) for the libvirt network? Is is 9.1.1.101? If not, and if that IP is on the physical ethernet device of the host, then you're trying to put the libvirt routed network on the same subnet as the physical network, which is not the intended use for mode='route'.

The idea of mode='route' is that you have a separate subnet that is fully contained in the host, and the host uses IP  routing to forward traffic between that "virtual" subnet and the physical network. This is only useful if you have enough control over the physical network to add a routing table entry that points external traffic for the virtual network towards the physical adapter on the host.

If that's not what you want, and what you really want is for the guest to be on the same subnet as the physical network, then you need to create a host bridge device outside of libvirt, and directly attach the physical ethernet device on the host to that bridge. Then you will attach the guests' interfaces to that bridge. There are instructions for creating a bridge device on various distros here:


https://wiki.libvirt.org/page/Networking#Host_configuration_2


Will it be a Routed mode problem?

My first suspicion is that you've misunderstood the purpose of <forward mode='route'> networks. If not, then provide more information (e.g. the IP address of the host's physical ethernet, the full XML of the virtual network you created, the <interface> section of the guest's configuration) and we can try to troubleshoot further.


How can I solve this problem?

Thank you
Marcelo


_______________________________________________
libvirt-users mailing list
libvirt-users@redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users