1. PPP with the pty Argument
    1. Author
    2. Commands
    3. Summary
    4. Discussion

PPP with the pty Argument

Author

Commands

# start with an empty set of ppp options
mv /etc/ppp/options /etc/ppp/options.bak
touch /etc/ppp/options

pppd nodetach 10.0.3.1:10.0.3.2 pty "pppd notty"

These commands all have to be run from the root account.

Summary

Connecting two pppd commands together by embedding one inside the pty argument of another.

Discussion

Out first two commands move the existing /etc/ppp/options file out of the way and replace it with an empty file.

The pppd command will behave very differently depending on how all of its billion and one options are set. When experimenting, it's best to empty the /etc/ppp/options file so the only options in effect are the ones we supply on the command line. Each linux distribution may ship with a potentially different /etc/ppp/options file; you may want to save the default file somewhere before creating an empty one so you can restore the distribution's default policies once you are done experimenting.

The third command uses the pty argument to run two pppd processes in the same configuration as the article ../PPP_with_Pseudo_Terminals. When a pppd command is given a "pty" argument, the command forks another process to execute the pty argument and, instead of transmitting its packets through a serial device, transmits to the standard-in stream of the forked process and attempts to read packets from the stardard-out stream of the process.

The nodetach option prevents pppd from detaching from the terminal session it is invoked from, like it normally would, and sending its error and status messages to the syslog. Instead, it remains in the foreground, where it can easily be killed with a cntl-c, and all of its diagnostic output is printed to stdout. Without this option, you would be forced to do something like this to see the command's diagnostic messages:

tail -f /var/log/messages

The command specified in the pty argument is, itself, a pppd command with a single argument, notty. The notty argument is informing the pppd command that its standard-in and standard-out streams are not connected to a tty device (either a serial line or a pseudo terminal) and it shouldn't bother trying to locate the tty device so it can attempt to set the baud rate, parity, ...

The 10.0.3.1:10.0.3.2 argument is telling the outer pppd command to configure its end of the connection with IP address 10.0.3.1 and to tell the inner pppd command, when it asks, that it should set the IP address of its side of the connection to 10.0.3.2.

The discussion about pinging 10.0.3.1 or 10.0.3.2 in ../PPP_with_Pseudo_Terminals applies equally to this scenario.

hopeless_linux: ppp/PPP with a pty Argument (last modified 2007-07-01 16:01:00)