ppp-on-ssh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. # You'd definitely want to change the following addresses to suit
  10. # your network configuration
  11. #
  12. LOC_IP=10.0.0.1
  13. REM_IP=10.0.0.2
  14. NETMASK=255.255.0.0
  15. export LOC_IP REM_IP
  16. #
  17. # This is the remote peer where sshd is running, either
  18. # its hostname or IP address
  19. #
  20. PPPD_RHOST=myremotehost
  21. #
  22. # For this example, we assume that pppd on both local and remote
  23. # machines reside in the same place, /usr/local/bin/pppd
  24. #
  25. PPPD_LOC=/usr/local/bin/pppd
  26. #
  27. # The location of local options file (where ssh client is running).
  28. # Note that the sample options file included in the distribution
  29. # may need further customizations, depending on your needs. The 'noauth'
  30. # option specified in the file is there to simplify the example, although
  31. # some may choose to have it there and rely on ssh authentication
  32. # instead.
  33. #
  34. PPPD_LOC_OPT=/etc/ppp/options-ssh-loc
  35. #
  36. # The location of remote options file (where sshd daemon is running)
  37. # Note that the sample options file included in the distribution
  38. # may need further customizations, depending on your needs. The 'noauth'
  39. # option specified in the file is there to simplify the example, although
  40. # some may choose to have it there and rely on ssh authentication
  41. # instead. Also note that the remote options file need to include the 'notty'
  42. # options for this to work.
  43. #
  44. PPPD_REM_OPT=/etc/ppp/options-ssh-rem
  45. #
  46. # The location of ssh client on the local machine
  47. #
  48. SSH_LOC=/usr/local/bin/ssh
  49. export PPPD_LOC PPPD_LOC_OPT PPPD_REM_OPT PPPD_RHOST SSH_LOC
  50. #
  51. # Uncomment the following to enable IPv6, note that the IPv6 support
  52. # needs to be enabled during compilation
  53. #
  54. # PPPD_IPV6='+ipv6 ipv6cp-use-ipaddr'
  55. export PPPD_IPV6
  56. #
  57. # And execute pppd with the pty option, specifying ssh client as the
  58. # slave side of the pseudo-tty master/slave pair. Note that on this example,
  59. # ssh has been compiled to allow NULL encryption (thus the '-c none' option),
  60. # but in reality, you'd probably want to specify the encryption algorithm.
  61. # See the man page of ssh(1) for details.
  62. #
  63. exec $PPPD_LOC \
  64. pty '$SSH_LOC -c none $PPPD_RHOST $PPPD_LOC $REM_IP:$LOC_IP $PPPD_IPV6 file $PPPD_REM_OPT' \
  65. $LOC_IP:$REM_IP netmask $NETMASK $PPPD_IPV6 file $PPPD_LOC_OPT