Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
#######
#
# E-scripts on making a linux box behave as two (in many senses)
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/a/e/net.e>
#           or at <http://angg.twu.net/e/net.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######





#####
#
# ppp to the same machine
# 99sep27
#
#####

# «ppp_to_the_same_machine»

# (find-es "modem" "patna_to_angg")

# (find-k2file "Documentation/")
# (find-k2file "Documentation/devices.txt" "pty")

expect -c '
  set timeout -1
  spawn /usr/sbin/pppd 10.0.2.1:10.0.2.2 crtscts noproxyarp
  set serv $spawn_id
  spawn /usr/sbin/pppd defaultroute noipdefault crtscts noproxyarp
  set client $spawn_id
  interact {
    -input $serv -output $client
    -input $client -output $serv
    -input $user_spawn_id
      "ii" {spawn ifconfig; expect eof}
      "ps" {send_user [exec ps ax | grep ppp]\n}
      "qq" {exit}
  }
'

# Aaargh, it's complaining about a loopback

pdsc /big/slinks1/dists/slink/main/source/base/ppp_2.3.5-2.dsc
cd /usr/src/ppp-2.3.5/
agrep 'Serial line is looped back' $(find *)

# (find-fline "/usr/src/ppp-2.3.5/FAQ" "Serial line is looped back")
# (find-fline "/usr/src/ppp-2.3.5/pppd/lcp.c" "Serial line is looped back")

# (find-fline "/var/log/" "ppp")
# (find-fline "/var/log/ppp.log")





#####
#
# ppp to the same machine: an unsent question
#
#####

About PPPing to the same machine

Hi,

  I'm trying to devise a simple way to let people connect to the same
machine using PPP to let them experiment with access permissions,
firewalls, sniffers, etc, without requiring them to have more than one
physical machine. But -- as always -- I'm running on lots of problems.
I'm using ppp-2.3.5 on Linux, with kernel 2.0.37; I'm using the Debian
2.1 distribution.

First problem: about 50% of the time PPP aborts with the error (of
level LOG_NOTICE, which goes to /var/log/ppp.log on my system) "Serial
line is looped back" when I run the expect script below.

expect -c '
  set timeout -1
  spawn /usr/sbin/pppd 10.0.2.1:10.0.2.2 crtscts noproxyarp
  set serv $spawn_id
  # Do I need this sleep? It doesnt change the probabilities much anyway.
  sleep 0.5
  spawn /usr/sbin/pppd defaultroute noipdefault crtscts noproxyarp
  set client $spawn_id
  #
  # Main loop: connect the two ppps, send a copy of all traffic to
  # stdout, and accepts three commands from the user: if the user types
  # "qq", leave; if "ii", run "ifconfig" and continue; if "ps", display
  # which processes have "ppp" in their names and continue.
  interact {
    -input $serv -output $client  -output $user_spawn_id
    -input $client -output $serv  -output $user_spawn_id
    -input $user_spawn_id
      "ii" {spawn ifconfig; expect eof}
      "ps" {send_user [exec ps ax | grep ppp]\n}
      "qq" {exit}
  }
'

Second: /sbin/route hangs when I run it after the connection is made;
cat /proc/net/route is ok. This isn't very important, I think, and I
haven't tried to trace this error very far.

Third:

tcpdump
lynx
ftp
telnet









#  Local Variables:
#  coding:               no-conversion
#  ee-delimiter-hash:    "\n#*\n"
#  ee-delimiter-percent: "\n%*\n"
#  ee-anchor-format:     "«%s»"
#  ee-charset-indicator: "Ñ"
#  End: