Answer the question
In order to leave comments, you need to log in
How to forward routes for Double OpenVPN?
There is a router. Goes online through the so-called Russian PPPOE.
The OpenVPN client and server are also raised on it.
The client connects to another OpenVPN server that I don't have access to.
The task is this.
1) For OpenVPN Client to knock on another OpenVPN server directly via the Internet.
2) Make it so that the OpenVPN Server on the router sends / receives packets through the OpenVPN Client.
3) All users that are connected to the router via Wifi or Lan directly without OpenVPN got to the Internet in a standard way, that is, through Russian PPPOE ignoring the OpenVPN Client. And those who connect via OpenVPN followed point 1.
There are interfaces on the router. Where tun0 is OpenVPN Server and tun1 is Client. eth0 - provider's locale, ppp0 - access to the Internet.
eth0 Link encap:Ethernet HWaddr 08:60:6E:71:B1:FE
inet addr:172.18.4.130 Bcast:172.18.4.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8914 errors:0 dropped:0 overruns:0 frame:0
TX packets:10659 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4665579 (4.4 MiB) TX bytes:4933303 (4.7 MiB)
Interrupt:4 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 30:5A:3A:72:7B:D0
UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:2929 errors:0 dropped:0 overruns:0 frame:6482
TX packets:4220 errors:1 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:449782 (439.2 KiB) TX bytes:692048 (675.8 KiB)
Interrupt:3 Base address:0x8000
eth2 Link encap:Ethernet HWaddr 30:5A:3A:72:7B:D4
UP BROADCAST RUNNING ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:238 errors:0 dropped:0 overruns:0 frame:43
TX packets:1876 errors:1 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:77690 (75.8 KiB) TX bytes:273883 (267.4 KiB)
Interrupt:5 Base address:0x8000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU:16436 Metric:1
RX packets:269 errors:0 dropped:0 overruns:0 frame:0
TX packets:269 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:51302 (50.0 KiB) TX bytes:51302 (50.0 KiB)
ppp0 Link encap:Point-to-Point Protocol
inet addr:109.200.200.209 P-t-P:210.230.0.200 Mask:255.255.255.255
UP POINTOPOINT RUNNING MULTICAST MTU:1492 Metric:1
RX packets:4294 errors:0 dropped:0 overruns:0 frame:0
TX packets:2987 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:3711004 (3.5 MiB) TX bytes:680220 (664.2 KiB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-0 0-00
inet addr:10.8.0.1 P-t-P:10.8.0.1 Mask:255.255.255.0
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
tun1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-0 0-00
inet addr:10.12.248.93 P-t-P:10.12.248.93 Mask:255.0.0.0
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:40 (40.0 B)
vlan1 Link encap:Ethernet HWaddr 30:5A:3A:72:7B:D0
UP BROADCAST RUNNING PROMISC ALLMULTI MULTICAST MTU:1500 Metric:1
RX packets:3470 errors:0 dropped:0 overruns:0 frame:0
TX packets:5590 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:702107 (685.6 KiB) TX bytes:3981627 (3.7 MiB)
vlan2 Link encap:Ethernet HWaddr 30:5A:3A:72:7B:D0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
192.168.1.1 via 172.18.4.1 dev eth0 metric 1
192.168.1.115 via 172.18.4.1 dev eth0 metric 1
94.242.216.66 via 213.231.0.200 dev ppp0
194.143.136.5 via 172.18.4.1 dev eth0 metric 1
213.231.0.200 dev ppp0 proto kernel scope link src 109.200.200.203
192.168.1.11 via 172.18.4.1 dev eth0 metric 1
172.18.54.0/24 dev eth0 proto kernel scope link src 172.18.4.13
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.1
192.168.1.0/24 via 172.18.4.1 dev eth0 metric 1
192.168.0.0/24 dev br0 proto kernel scope link src 192.168.0.1
172.18.0.0/16 via 172.18.4.1 dev eth0 metric 1
172.19.0.0/16 via 172.18.4.1 dev eth0 metric 1
172.17.0.0/16 via 172.18.4.1 dev eth0 metric 1
10.0.0.0/8 dev tun1 proto kernel scope link src 10.12.248.93
127.0.0.0/8 dev lo scope link
0.0.0.0/1 via 10.255.255.254 dev tun1
128.0.0.0/1 via 10.255.255.254 dev tun1
default via 210.230.0.200 dev ppp0
default via 172.18.4.1 dev eth0 metric 1
Answer the question
In order to leave comments, you need to log in
10.12.248.93/8
10.8.0.1/24
well, first of all, set up your OpenVPN server, the address is in a different subnet,
but in general,
ip rule add from 10.8.0.0/24* lookup 100
* -change to a new one
ip route add default via 10.255 .255.254 dev tun1 table 100
iptables -t nat -A POSTROUTING -o tun1 -j MASQUERADE
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question