Linux/Routing: Difference between revisions

From Wiki
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Example ==
== How can service D communicate with Service A? ==
<pre>
<pre>
                                                            [                 Server VM               ]
[           HomeserverVM - 1          ]                [               ServerVM - 2              ]
Docker:Service A <--> Docker: OpenVPN Client <-------------> Docker: OpenVPN Server <--> Docker: Service B
Docker:Service A   <-->   OpenVPN Client <-------------> Docker: OpenVPN Server <--> Docker: Service D
      >A<                    >B<                                      >C<                      >D<
   172.111.1.2            10.8.0.2                                172.1.4.3                172.1.4.5
   172.111.1.2            10.8.0.2                                172.1.4.3                172.1.4.5
</pre>
</pre>
How can service B communicate with Service A?


 
=== 2) Server VM ===
 
== Server VM ==  
<pre>
<pre>
ip route add 172.111.0.0/16 via 172.1.4.3 dev br-...openvpncontainer..
ip route add 172.111.0.0/16 via 172.1.4.3 dev br-...openvpncontainer..
</pre>
</pre>


== Open VPN Server ==
 
=== 2-C)OpenVPN Server ===
<pre>
<pre>
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
</pre>


server.conf:
route 172.111.0.0 255.255.0.0


clients/homeserver:
iroute 172.111.0.0 255.255.0.0
</pre>


[[Category:Linux/Network]]
[[Category:Linux/Network]]
[[Category:Linux]]
[[Category:Linux]]

Latest revision as of 16:05, 18 July 2019

How can service D communicate with Service A?

[           HomeserverVM - 1           ]                 [                ServerVM - 2               ]
Docker:Service A   <-->   OpenVPN Client <-------------> Docker: OpenVPN Server <--> Docker: Service D
       >A<                    >B<                                      >C<                      >D<
   172.111.1.2             10.8.0.2                                172.1.4.3                 172.1.4.5

2) Server VM

ip route add 172.111.0.0/16 via 172.1.4.3 dev br-...openvpncontainer..


2-C)OpenVPN Server

iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE

server.conf:
route 172.111.0.0 255.255.0.0

clients/homeserver:
iroute 172.111.0.0 255.255.0.0