f



PPTP Client NAT (Device -- PAT/Gateway/PPTP -- Device)

Hi Guys

I am not that familiar with Linux and therefore I thought I would ask the experts on this group for some advise.

I want to connect a network device on my LAN at home to my network at the office using PPTP. The device does not support pptp directly.

I thought of using Ubuntu to start testing this. (I had an ISO on hand any Linux Distro will work I guess) 
I want to route the device's traffic to the Gateway.

The Ubuntu box then does the PAT then forwards the traffic to the PPTP Server.
When traffic returns, it will return it to the device. The device does not know it goes through a NAT/PPTP device.

I managed to configure that PPTP and routing portion on the gateway and have tested that successfully but would really apreciate some assistance in the PAT/Forwarding portion.


0
Fanie
6/6/2016 9:42:17 AM
comp.os.linux.networking 15677 articles. 0 followers. Post Follow

4 Replies
270 Views

Similar Articles

[PageSpeed] 4

On 6.6.16 12:42, Fanie van Vuuren wrote:
> Hi Guys
>
> I am not that familiar with Linux and therefore I thought I would ask the experts on this group for some advise.
>
> I want to connect a network device on my LAN at home to my network at the office using PPTP. The device does not support pptp directly.
>
> I thought of using Ubuntu to start testing this. (I had an ISO on hand any Linux Distro will work I guess)
> I want to route the device's traffic to the Gateway.
>
> The Ubuntu box then does the PAT then forwards the traffic to the PPTP Server.
> When traffic returns, it will return it to the device. The device does not know it goes through a NAT/PPTP device.
>
> I managed to configure that PPTP and routing portion on the gateway and have tested that successfully but would really apreciate some assistance in the PAT/Forwarding portion.


Here, I must first warn that you must be in agreement with the office 
networking administrators to extend their network.

You need to have a local network between your 'device' and the Linux 
box. Then, you need to forward the local network via the PPTP link to 
the office network.

It is not clear, which kind of address translation you're after, but 
Google for 'Linux NAT' and 'Linux port forwarding', and you'll get 
plenty of HOWTO -style instructions.

-- 

-TV

0
Tauno
6/6/2016 11:35:34 AM
On Monday, 6 June 2016 13:35:38 UTC+2, Tauno Voipio  wrote:
> On 6.6.16 12:42, Fanie van Vuuren wrote:
> > Hi Guys
> >
> > I am not that familiar with Linux and therefore I thought I would ask the experts on this group for some advise.
> >
> > I want to connect a network device on my LAN at home to my network at the office using PPTP. The device does not support pptp directly.
> >
> > I thought of using Ubuntu to start testing this. (I had an ISO on hand any Linux Distro will work I guess)
> > I want to route the device's traffic to the Gateway.
> >
> > The Ubuntu box then does the PAT then forwards the traffic to the PPTP Server.
> > When traffic returns, it will return it to the device. The device does not know it goes through a NAT/PPTP device.
> >
> > I managed to configure that PPTP and routing portion on the gateway and have tested that successfully but would really apreciate some assistance in the PAT/Forwarding portion.
> 
> 
> Here, I must first warn that you must be in agreement with the office 
> networking administrators to extend their network.
> 
> You need to have a local network between your 'device' and the Linux 
> box. Then, you need to forward the local network via the PPTP link to 
> the office network.
> 
> It is not clear, which kind of address translation you're after, but 
> Google for 'Linux NAT' and 'Linux port forwarding', and you'll get 
> plenty of HOWTO -style instructions.
> 
> -- 
> 
> -TV

Hi and thanks for the response.

I have been googling and got to a point where I am forwarding traffic to the ppp0 adaptor, problem is that it does not change the source IP to the ppp0 adaptors IP. It send the original IP from the LAN when looking at Wireshark.
So when received on the office network side it wont route it back correctly.

I suspect it is something with the iptables or perhaps I missed something else somewhere.

iptables -I OUTPUT -o ppp0 -j ACCEPT
iptables -I INPUT -i ppp0 -j ACCEPT
iptables -I FORWARD -o ppp0 -j ACCEPT
iptables -I FORWARD -i ppp0 -j ACCEPT
iptables -t nat -I POSTROUTING -o ppp0 -j MASQUERADE
0
Fanie
6/6/2016 12:50:30 PM
On 6.6.16 15:50, Fanie van Vuuren wrote:
> On Monday, 6 June 2016 13:35:38 UTC+2, Tauno Voipio  wrote:
>> On 6.6.16 12:42, Fanie van Vuuren wrote:
>>> Hi Guys
>>>
>>> I am not that familiar with Linux and therefore I thought I would ask the experts on this group for some advise.
>>>
>>> I want to connect a network device on my LAN at home to my network at the office using PPTP. The device does not support pptp directly.
>>>
>>> I thought of using Ubuntu to start testing this. (I had an ISO on hand any Linux Distro will work I guess)
>>> I want to route the device's traffic to the Gateway.
>>>
>>> The Ubuntu box then does the PAT then forwards the traffic to the PPTP Server.
>>> When traffic returns, it will return it to the device. The device does not know it goes through a NAT/PPTP device.
>>>
>>> I managed to configure that PPTP and routing portion on the gateway and have tested that successfully but would really apreciate some assistance in the PAT/Forwarding portion.
>>
>>
>> Here, I must first warn that you must be in agreement with the office
>> networking administrators to extend their network.
>>
>> You need to have a local network between your 'device' and the Linux
>> box. Then, you need to forward the local network via the PPTP link to
>> the office network.
>>
>> It is not clear, which kind of address translation you're after, but
>> Google for 'Linux NAT' and 'Linux port forwarding', and you'll get
>> plenty of HOWTO -style instructions.
>>
>> --
>>
>> -TV
>
> Hi and thanks for the response.
>
> I have been googling and got to a point where I am forwarding traffic to the ppp0 adaptor, problem is that it does not change the source IP to the ppp0 adaptors IP. It send the original IP from the LAN when looking at Wireshark.
> So when received on the office network side it wont route it back correctly.
>
> I suspect it is something with the iptables or perhaps I missed something else somewhere.
>
> iptables -I OUTPUT -o ppp0 -j ACCEPT
> iptables -I INPUT -i ppp0 -j ACCEPT
> iptables -I FORWARD -o ppp0 -j ACCEPT
> iptables -I FORWARD -i ppp0 -j ACCEPT
> iptables -t nat -I POSTROUTING -o ppp0 -j MASQUERADE


I have the POSTROUTING setup a bit different, maybe because there are 
much more complicated rules in the tables:

iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

You may be missing the IP forwarding enable:

echo 1 > /proc/sys/net/ipv4/ip_forward

Before running the echo, you can check:

cat /proc/sys/net/ipv4/ip_forward

-- 

-TV

0
Tauno
6/6/2016 1:12:28 PM
On Monday, 6 June 2016 15:12:32 UTC+2, Tauno Voipio  wrote:
> On 6.6.16 15:50, Fanie van Vuuren wrote:
> > On Monday, 6 June 2016 13:35:38 UTC+2, Tauno Voipio  wrote:
> >> On 6.6.16 12:42, Fanie van Vuuren wrote:
> >>> Hi Guys
> >>>
> >>> I am not that familiar with Linux and therefore I thought I would ask the experts on this group for some advise.
> >>>
> >>> I want to connect a network device on my LAN at home to my network at the office using PPTP. The device does not support pptp directly.
> >>>
> >>> I thought of using Ubuntu to start testing this. (I had an ISO on hand any Linux Distro will work I guess)
> >>> I want to route the device's traffic to the Gateway.
> >>>
> >>> The Ubuntu box then does the PAT then forwards the traffic to the PPTP Server.
> >>> When traffic returns, it will return it to the device. The device does not know it goes through a NAT/PPTP device.
> >>>
> >>> I managed to configure that PPTP and routing portion on the gateway and have tested that successfully but would really apreciate some assistance in the PAT/Forwarding portion.
> >>
> >>
> >> Here, I must first warn that you must be in agreement with the office
> >> networking administrators to extend their network.
> >>
> >> You need to have a local network between your 'device' and the Linux
> >> box. Then, you need to forward the local network via the PPTP link to
> >> the office network.
> >>
> >> It is not clear, which kind of address translation you're after, but
> >> Google for 'Linux NAT' and 'Linux port forwarding', and you'll get
> >> plenty of HOWTO -style instructions.
> >>
> >> --
> >>
> >> -TV
> >
> > Hi and thanks for the response.
> >
> > I have been googling and got to a point where I am forwarding traffic to the ppp0 adaptor, problem is that it does not change the source IP to the ppp0 adaptors IP. It send the original IP from the LAN when looking at Wireshark.
> > So when received on the office network side it wont route it back correctly.
> >
> > I suspect it is something with the iptables or perhaps I missed something else somewhere.
> >
> > iptables -I OUTPUT -o ppp0 -j ACCEPT
> > iptables -I INPUT -i ppp0 -j ACCEPT
> > iptables -I FORWARD -o ppp0 -j ACCEPT
> > iptables -I FORWARD -i ppp0 -j ACCEPT
> > iptables -t nat -I POSTROUTING -o ppp0 -j MASQUERADE
> 
> 
> I have the POSTROUTING setup a bit different, maybe because there are 
> much more complicated rules in the tables:
> 
> iptables -t nat -P POSTROUTING ACCEPT
> iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
> 
> You may be missing the IP forwarding enable:
> 
> echo 1 > /proc/sys/net/ipv4/ip_forward
> 
> Before running the echo, you can check:
> 
> cat /proc/sys/net/ipv4/ip_forward
> 
> -- 
> 
> -TV

Thanks I think I got it to work the way I want it to work using

iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o ppp0 -j MASQUERADE
0
Fanie
6/6/2016 1:26:32 PM
Reply: