lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # A sample script to establish PPP session(s) via SSH 1.x |
| 4 | # |
| 5 | # Adi Masputra <adi.masputra@sun.com> |
| 6 | # Jan 24, 2000 |
| 7 | # |
| 8 | |
| 9 | # |
| 10 | # You'd definitely want to change the following addresses to suit |
| 11 | # your network configuration |
| 12 | # |
| 13 | LOC_IP=10.0.0.1 |
| 14 | REM_IP=10.0.0.2 |
| 15 | NETMASK=255.255.0.0 |
| 16 | |
| 17 | export LOC_IP REM_IP |
| 18 | |
| 19 | # |
| 20 | # This is the remote peer where sshd is running, either |
| 21 | # its hostname or IP address |
| 22 | # |
| 23 | PPPD_RHOST=myremotehost |
| 24 | |
| 25 | # |
| 26 | # For this example, we assume that pppd on both local and remote |
| 27 | # machines reside in the same place, /usr/local/bin/pppd |
| 28 | # |
| 29 | PPPD_LOC=/usr/local/bin/pppd |
| 30 | |
| 31 | # |
| 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. |
| 38 | # |
| 39 | PPPD_LOC_OPT=/etc/ppp/options-ssh-loc |
| 40 | |
| 41 | # |
| 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. |
| 49 | # |
| 50 | PPPD_REM_OPT=/etc/ppp/options-ssh-rem |
| 51 | |
| 52 | # |
| 53 | # The location of ssh client on the local machine |
| 54 | # |
| 55 | SSH_LOC=/usr/local/bin/ssh |
| 56 | |
| 57 | export PPPD_LOC PPPD_LOC_OPT PPPD_REM_OPT PPPD_RHOST SSH_LOC |
| 58 | |
| 59 | # |
| 60 | # Uncomment the following to enable IPv6, note that the IPv6 support |
| 61 | # needs to be enabled during compilation |
| 62 | # |
| 63 | # PPPD_IPV6='+ipv6 ipv6cp-use-ipaddr' |
| 64 | export PPPD_IPV6 |
| 65 | |
| 66 | # |
| 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. |
| 72 | # |
| 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 |
| 76 | |