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

1 Response to “Share Internet connection between two Linux machines using RS-232 serial port null modem cable”



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Howdy!

Linux related stuff and more. Yay!

del.icio.us


%d bloggers like this: