Tomato 1.28
[tomato.git] / release / src / router / ppp / scripts / ppp-on-ssh
blob0e41acac6fd41b1108621c095dbf67852506441b
1 #!/bin/sh
3 # A sample script to establish PPP session(s) via SSH 1.x
5 # Adi Masputra <adi.masputra@sun.com>
6 # Jan 24, 2000
10 # You'd definitely want to change the following addresses to suit
11 # your network configuration
13 LOC_IP=10.0.0.1
14 REM_IP=10.0.0.2
15 NETMASK=255.255.0.0
17 export LOC_IP REM_IP
20 # This is the remote peer where sshd is running, either
21 # its hostname or IP address
23 PPPD_RHOST=myremotehost
26 # For this example, we assume that pppd on both local and remote
27 # machines reside in the same place, /usr/local/bin/pppd
29 PPPD_LOC=/usr/local/bin/pppd
32 # The location of local options file (where ssh client is running).
33 # Note that the sample options file included in the distribution
34 # may need further customizations, depending on your needs. The 'noauth'
35 # option specified in the file is there to simplify the example, although
36 # some may choose to have it there and rely on ssh authentication
37 # instead.
39 PPPD_LOC_OPT=/etc/ppp/options-ssh-loc
42 # The location of remote options file (where sshd daemon is running)
43 # Note that the sample options file included in the distribution
44 # may need further customizations, depending on your needs. The 'noauth'
45 # option specified in the file is there to simplify the example, although
46 # some may choose to have it there and rely on ssh authentication
47 # instead. Also note that the remote options file need to include the 'notty'
48 # options for this to work.
50 PPPD_REM_OPT=/etc/ppp/options-ssh-rem
53 # The location of ssh client on the local machine
55 SSH_LOC=/usr/local/bin/ssh
57 export PPPD_LOC PPPD_LOC_OPT PPPD_REM_OPT PPPD_RHOST SSH_LOC
60 # Uncomment the following to enable IPv6, note that the IPv6 support
61 # needs to be enabled during compilation
63 # PPPD_IPV6='+ipv6 ipv6cp-use-ipaddr'
64 export PPPD_IPV6
67 # And execute pppd with the pty option, specifying ssh client as the
68 # slave side of the pseudo-tty master/slave pair. Note that on this example,
69 # ssh has been compiled to allow NULL encryption (thus the '-c none' option),
70 # but in reality, you'd probably want to specify the encryption algorithm.
71 # See the man page of ssh(1) for details.
73 exec $PPPD_LOC \
74 pty '$SSH_LOC -c none $PPPD_RHOST $PPPD_LOC $REM_IP:$LOC_IP $PPPD_IPV6 file $PPPD_REM_OPT' \
75 $LOC_IP:$REM_IP netmask $NETMASK $PPPD_IPV6 file $PPPD_LOC_OPT