I have в small ubuntu box which I want to использовал to бридж 2 networks together over VPN.
One network is in the 192.168.2.0/24 range.
The other network is in the 192.168.93/24 range.
Саид ubuntu box is physically (путь eth0) connected to the latter network, and - IP 192.168.93.11. On the other hand this box will establish an OpenVPN connection to the router of the first network, in which it will get IP address 192.168.2.162.
So I have one box with 2 IPs:
- eth0: 192.168.93.11
- tap0: 192.168.2.162
In both networks I have в router in which I хан конфигурировал в static route so that any traffic for the other network is forwarded to the помещение IP of the ubuntu box.
My question is, how хан I get the ubuntu box, presumably using iptables, to forward traffic for the other network, from eth0 to tap0 and vice поворачивает?
Попробуйте это на своем поле после того, как все Ваши статические маршруты существуют на Ваших маршрутизаторах, и Ваше поле подключено к VPN (так, чтобы tap0
было доступно):
root@yourbox:~# sysctl -w net.ipv4.ip_foward=1
root@yourbox:~# iptables -A FORWARD -s 192.168.2.0/24 -d 192.168.93.0/24 -j ACCEPT
root@yourbox:~# iptables -A FORWARD -s 192.168.93.0/24 -d 192.168.2.0/24 -j ACCEPT
то, Что сделают вышеупомянутые 3 команды,
, 1) Позволяют передаче IP в Вашем ядре для него направить пакеты между этими двумя сетями
, 2) Принимают любой трафик, который прибывает из 192.168.2.0/24
сеть и предназначенный для 192.168.93.0/24
, сеть
3) Принимает любой трафик, который прибывает из 192.168.93.0/24
сеть и предназначенный для 192.168.2.0/24
сеть
Hope, которой это помогает. :)