Sinisterly
Route traffic from vpn clients of one server to second server - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Computers (https://sinister.ly/Forum-Computers)
+--- Forum: Networking (https://sinister.ly/Forum-Networking)
+--- Thread: Route traffic from vpn clients of one server to second server (/Thread-Route-traffic-from-vpn-clients-of-one-server-to-second-server)



Route traffic from vpn clients of one server to second server - gamblad42 - 07-29-2018

Hello. I have one vpn server(server A). Server A is connected to other vpn server(server B). Server A has some clients.

Is it possible to route only traffic from vpn clients of server A to the connection of server B, so the machine A will use default internet connection?

Each of clients is connected to some ppp+ interface(ppp1-10) and has the ip address 11.0.0.1-10. 11.0.1.1 - ip of pptpd server. Ppp0 is the interface of connection to server B.

ifconfig output:
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
       ether e8:03:9a:93:07:53  txqueuelen 1000  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 0  bytes 0 (0.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10<host>
       loop  txqueuelen 1000  (Local Loopback)
       RX packets 13486316  bytes 3242965197 (3.0 GiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 13486316  bytes 3242965197 (3.0 GiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1400
       inet 192.168.1.50  netmask 255.255.255.255  destination 192.168.1.1
       ppp  txqueuelen 3  (Point-to-Point Protocol)
       RX packets 12  bytes 949 (949.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 12  bytes 1411 (1.3 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ppp1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1396
       inet 11.0.1.1  netmask 255.255.255.255  destination 11.0.0.1
       ppp  txqueuelen 3  (Point-to-Point Protocol)
       RX packets 7  bytes 88 (88.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 7  bytes 82 (82.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 192.168.1.4  netmask 255.255.255.0  broadcast 192.168.1.255
       inet6 fe80::9244:b58:9664:49b3  prefixlen 64  scopeid 0x20<link>
       ether b8:03:05:4f:8a:44  txqueuelen 1000  (Ethernet)
       RX packets 3950317  bytes 2674081227 (2.4 GiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 9771716  bytes 2046374004 (1.9 GiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

route -n output:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     50     0        0 ppp0
0.0.0.0         192.168.1.1     0.0.0.0         UG    600    0        0 wlan0
11.0.0.1        0.0.0.0         255.255.255.255 UH    0      0        0 ppp1
"ip of server B"     192.168.1.1     255.255.255.255 UGH   0      0        0 wlan0
"ip of server B"     192.168.1.1     255.255.255.255 UGH   600    0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 wlan0
192.168.1.1     0.0.0.0         255.255.255.255 UH    50     0        0 ppp0
192.168.1.1     0.0.0.0         255.255.255.255 UH    600    0        0 wlan0

I can only disable default routing to ppp0 by deleting first line of routing table. But i don't know how to route traffic from vpn clients to it.


RE: Route traffic from vpn clients of one server to second server - Cryogenica - 08-05-2018

You can configure iptables to redirect from one network interface to another. This process is pretty simple, and with a bit of googling you should be able to configure IP forwarding. Maybe you gould look up how to set up a NAT with iptables and configure IP forwarding.