# [SOLVED]pppd / pptpclient so near to working perfectly!

## Oyst3h

Finally, I have managed to get a working connection to the Win2k3 server at work using ppp 2.4.2 and pptpclient.   Thanks to ytak for howto here.

But...  I can't get my head around getting the routing and dns to update itself automatically.   I'm not using the pptpconfig package (I don't have apache installed, and there's about 50Mb of dependencies to install just for a gui - so I'd rather not, if possible).

It's basically three issues that I would welcome some help with.

I've created /etc/ppp/peers/BMS with the correct params to connect to work.   Now I can just run "pon BMS" or "pppd call BMS" and the VPN starts just fine.  The /etc/ppp/ip-up script runs and changes my /etc/resolv.conf to use the nameservers at work.  But I also need to add a static route for the work LAN (10.15.0.0/16).   /etc/ppp/ip-up seems to check for a script at /etc/ppp/ip-up.local and executes this if it exists, so I have created the file /etc/ppp/ip-up.local, chmoded it executable, and added the following 

```

#!/bin/sh

route add -net 10.15.0.0/16 ppp0

```

This should automatically create a route for the LAN on the other side of the VPN, but it doesn't.   Works fine if I run it as a command once the VPN is up, but it's not running automatically.  Any idea why?

Also, when I take the VPN down (kill -term [PID of pppd]) the /etc/ppp/ip-down script is supposed to reset my nameservers to their previous value, but it doesn't run.   I have to manually type 

```
mv /etc/resolv.conf.pppd-backup /etc/resolv.conf
```

 to reset things (which is exactly what /etc/pp/ip-down should be doing).   If I start the pppd with the nodetach option in a separate window, the process when terminated as above produces pages of "Terminating on signal 15." followed by "Segmentation fault".  I'm sure this isn't right, and is probably why /etc/ppp/ip-down isn't running, but I've no idea what to do about it.

And I can't run pppd as a user.  It's setuid root, but fails to start the VPN with an error about unable to open GRE socket.  This is presumably a permissions issue, but again, I have no idea what (if anything) I can do about it.

Any response welcome, even if it's just sympathy!  :Wink: Last edited by Oyst3h on Fri Dec 10, 2004 2:10 pm; edited 1 time in total

----------

## Oyst3h

OK

I have made progress...

The route wasn't coming up because the ip-up script has no path defined to /sbin, so I changed the script to "/sbin/route add ..." and it now works.  This is documented, but it is amazing how easy it is to miss something so small, and yet so critical!  :Sad: 

The ip-down script is now running, because the pppd process is terminating cleanly.  Re-emerged ppp with the "mppe-mppc" flag and did NOT apply the patch from http://www.polbox.com/h/hs001/.   This patch seems to work, but (possibly) caused this issue, so it is not only not necessary, but not advisable to apply the ppp patch against the current ppp ebuild (2.4.2)

Still can't run pppd as non-root, however.

```

anon warn[pptp_gre_bind:pptp_gre.c:82]: socket: Operation not permitted

anon fatal[main:pptp.c:251]: Cannot bind GRE socket, aborting.

```

this is the exact error that is logged.    Still hoping for an explanation as to how I can maybe change a permission to allow this....

----------

## Oyst3h

Simple fix, and obvious now that I know.

Set pptp to be suid.

Thanks for listening!  :Smile: 

----------

## oldan

 *Oyst3h wrote:*   

> But...  I can't get my head around getting the routing and dns to update itself automatically.   I'm not using the pptpconfig package (I don't have apache installed, and there's about 50Mb of dependencies to install just for a gui - so I'd rather not, if possible).

 

That's what's stopping me from using pptpconfig too. Any ideas why emerge mistakenly thinks you need Apache to run pptpconfig?

--Oldan

----------

## Parasietje

Great topic! Very helpful for the community that you updated it. Maybe you could set the [Solved]  tag in your topic title?

----------

