I
I
IPv42015-03-12 10:43:11
VPN
IPv4, 2015-03-12 10:43:11

How to share internet in PPTP tunnel?

Hello toastors.
A PPTP tunnel has been created between the vds server on debian(1) and the server on Windows(2). Raised on server 1. Server 2 is connected to it.
Server 1 walks to the Internet through the eth0 interface . Connected server interface via ppp0 tunnel .
They communicate with each other without problems.
Tell me, how can I allow server 2 to access the Internet through a tunnel through a specific port?
For example, I want that when I try to connect to server 1 through port 2222 , I want to connect to server 2 on port 3333 .
I don’t rummage in iptables, I rummaged through the Internet, the proposed methods do not help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dobryshkin, 2015-03-12
@IPv4

Notation

$EXT_R_IP - внешний IP роутера
$LOCAL_IP - внутренний "фэйковый" адрес машины, которую надо "выкидывать" наружу
$PORT1 - Порт, на который будут заходить извне и попадать на локальную машину
$PORT2 - Порт, который "выбрасывается" наружу(например, 80 - http, либо 21 - ftp)

On the router we speak the following commands (from root)
# iptables -t nat -A PREROUTING -p tcp -d $EXT_R_IP --dport $PORT1 -j DNAT --to-destination $LOCAL_IP:$PORT2
# iptables -A FORWARD -i eth0 -d $LOCAL_IP -p tcp --dport $PORT2 -j ACCEPT

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question