-1

I have two servers A and B. Server A with device ens3 and address 10.1.0.171 and server B with device ens3 and address 10.1.0.253.

I want to setup on server A and server B networks 10.2.0.0/24, up vm instances, and I want access from vm from server A to vm from server B.

I tried to create on server A and server B bridge br0; add interfaces ens3 to br0, and up gretap tunnel. But I don't understand how can I connect gretap tunnel to local networks 10.2.0.0/24.

How can I implement it?

Thanks.

e42d3
  • 75
  • 2

2 Answers2

0

My suggestion would be that you split your 10.2.0.0/24 network into 2 distinct networks 10.2.0.0/25 and 10.2.0.128/25, one internal for each server, and then use IP in IP encapsulation to route the packets between those two networks.

You can find details how to do this in https://www.tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.tunnel.ip-ip.html.

user2233709
  • 1,384
  • 1
  • 10
  • 16
  • The same question. How can I connect tunnel to internal network? – e42d3 Sep 28 '19 at 18:54
  • @e42d3 I think I misunderstood your need. I tried a second answer; I will delete this one if you confirm my second answer fits your need better. – user2233709 Sep 28 '19 at 19:14
0

My suggestion would be that you split your 10.2.0.0/24 network into 2 distinct networks 10.2.0.0/25 and 10.2.0.128/25, first one internal to server A, second one internal to server B.

Then, you can add a route from server A to server B’s network:

ip route add 10.2.0.128/25 via 10.1.0.253

and from server B to server A’s network:

ip route add 10.2.0.0/25 via 10.1.0.171

Of course, you also have to enable IP packet forwarding:

sysctl net.ipv4.conf.all.forwarding=1

Note that I assume that servers are on the same network. If there is a router between them, you need to set up some tunneling, like IP in IP or GRE between the servers, and route through the tunnel.

user2233709
  • 1,384
  • 1
  • 10
  • 16