Linux/Routing

From Wiki
< Linux
Revision as of 15:58, 18 July 2019 by Marcluer (talk | contribs)

Example

[           Homeserver VM                  ]                 [                  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..


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