wok-next view ppp/stuff/pppnc-server @ rev 16686
trigger slitaz-dev-tools
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon May 19 17:35:09 2014 +0000 (2014-05-19) |
parents | |
children | 56c606af68bc |
line source
1 #!/bin/sh
3 ppp="/usr/sbin/pppd local noauth nodetach"
4 port=1111
5 ipupd=/etc/ppp/ip-up.d
7 case "$0" in
8 *server) # Usage: pppnc-server [port] [localip:remoteip]
9 n=10.$(($$%256)).$(($$/256))
10 exec $ppp ${2:-$n.1:$n.2} passive proxyarp pty "nc -lp ${1:-$port}"
11 esac
13 [ -z "$1" ] && echo "Usage: $0 serverip [port] [routes]" && exit 1
14 for i in $3 ; do
15 echo "route add -net $i dev \$1"
16 done > $ipupd/pppnc$$
17 chmod +x $ipupd/pppnc$$
18 $ppp noipdefault pty "nc $1 ${2:-$port}" ipparam pppnc$$
19 rm -f $ipupd/pppnc$$