Posts Tagged 'pppd share connection rs232 serial nullmodem bash script'

Share Internet connection between two Linux machines using RS-232 serial port null modem cable

This is a method for sharing Internet connection between two Linux powered machines using RS-232 serial port null modem cable and Point-to-Point Protocol daemon (PPPD).

Command on the host box:

pppd -detach debug dump crtscts lock proxyarp 192.168.1.201:192.168.1.200 /dev/ttyS0 38400

You need also to enable ip_forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward

Command on the client box:

pppd -detach debug dump crtscts lock defaultroute 192.168.1.200:192.168.1.201 /dev/ttyS0 38400

The described solution assumes that your /etc/ppp/options file is empty or absent as all the options are given in the command line. The pppd will terminate every time the client disconnects. If you don’t want to start it manually every time, you can use this script:

#!/bin/sh
until pppd -detach debug dump crtscts lock noauth proxyarp 192.168.1.201:192.168.1.200 /dev/ttyS0 38400; do
    echo "Respawning.." >&2
    sleep 1
done

It will wait until pppd terminates and start it again automatically. You need root permissions for all the above commands.

Advertisements

Howdy!

Linux related stuff and more. Yay!

del.icio.us