Linux/Routing: Difference between revisions

From Wiki
No edit summary
No edit summary
Line 1: Line 1:
== Example ==
== Example ==
<pre>
<pre>
                                                            [                  Server VM                ]
Docker:Service A <--> Docker: OpenVPN Client <-------------> Docker: OpenVPN Server <--> Docker: Service B
Docker:Service A <--> Docker: OpenVPN Client <-------------> Docker: OpenVPN Server <--> Docker: Service B
  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?
How can service B communicate with Service A?
== Server VM ==
<pre>
ip route add 172.111.0.0/16 via 172.1.4.3 dev br-...openvpncontainer..
</pre>
== Open VPN Server ==
<pre>
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
</pre>





Revision as of 14:06, 18 July 2019

Example

                                                             [                  Server VM                ]
Docker:Service A <--> Docker: OpenVPN Client <-------------> Docker: OpenVPN Server <--> Docker: Service B
   172.111.1.2             10.8.0.2                                172.1.4.3                 172.1.4.5

How can service B communicate with Service A?


Server VM

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

Open VPN Server

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