K
K
Kalombyr2019-04-21 14:48:18
linux
Kalombyr, 2019-04-21 14:48:18

How to set up routing between networks?

Good day.
There is a server "S", on the server the VPN client is lifted to another. When connecting, tun0 rises, with the address 10.100.0.22 Clients
connect to the "S" server via the enp4s0 interface with DHCP 192.168.0.1.
Clients go to the Internet through tun0, everything is fine.
It is necessary that the "S" clients could reach other clients in the VPN. From the server there is access, but from clients, of course, no.
Tell me, please, how to correctly configure the addressing, so that from 192.168.0.0 there would be access to 10.100.0.0?
The routing table is now:

Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0         10.100.0.21     0.0.0.0         UG        0 0          0 tun0
55.55.55.55     10.64.64.64     255.255.255.255 UGH       0 0          0 ppp0
10.64.64.64     0.0.0.0         255.255.255.255 UH        0 0          0 ppp0
10.100.0.0      10.100.0.21     255.255.255.0   UG        0 0          0 tun0
10.100.0.21     0.0.0.0         255.255.255.255 UH        0 0          0 tun0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 enp4s0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 enp4s0

ppp0 - Internet modem, through it the server "S" communicates with VPN
55.55.55.55 - external ip to the Internet.
Sorry for the illiterate description, I'm trying to understand.
UPDT:
It was necessary to allow traffic between interfaces in iptables:
iptables -A FORWARD -i enp4s0 -o tun0 -j ACCEPT

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2019-04-21
@Kalombyr

Try enabling masquerade on the S server
iptables -t nat -A POSTROUTING -o tun0 -s 192.168.0.0/24 -d 10.100.0.0/24 -j MASQUERADE

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question