|
You need a pppd (Point to Point Protocol Daemon) and a reasonable knowledge of how it works. Consult the relevant RFC's or the Linux PPP HOWTO if necessary. Since you are not going to use a login procedure, you don't use (m)getty and you do not need a (fake) user associated with the pppd controlling your link. You are not going to dial so you don't need any chat scripts either. In fact, the modem circuit and configuration you have just build, are rather like a fully wired null modem cable. This means you have to configure your pppd the same way as you would with a null modem cable.
For a reliable link, your setup should meet the following criteria;
Suppose the modem is connected to COM2, the local IP address is `Loc_Ip' and the remote IP address is `Rem_Ip'. We want to use 576 as our MTU. The /etc/ppp/options.ttyS1 would now be:
crtscts
mru 576
mtu 576
passive
Loc_Ip:Rem_Ip
-chap
modem
#noauth
-pap
persist
Stuff like `asyncmap 0', `lock', `modem' and `-detach' are probably already in
/etc/ppp/options. If not, add them to your
/etc/ppp/options.ttyS1.
So, if the local system is 192.168.1.1 and the remote system is 10.1.1.1,
then /etc/ppp/options.ttyS1 on the local system would be:
crtscts
mru 576
mtu 576
passive
192.168.1.1:10.1.1.1
-chap
modem
#noauth
-pap
persist
The options.ttyS1 on the remote system would be:
crtscts
mru 576
mtu 576
passive
10.1.1.1:192.168.1.1
-chap
modem
#noauth
-pap
persist
The passive option limits the number of (re)connection attempts.
The persist option will keep pppd alive in case of a disconnect or when it
can't connect in the first place.
If you telnet a lot while doing filetransfers (FTP or webbrowsing) at the
same time, you might want to use a smaller MTU and MRU such as 296. This
will make the remote system more responsive.
If you don't care much about telnetting during FTP, you could set the MTU
and MRU to 1500.
Keep in mind though, that UDP cannot be fragmented. Speakfreely for instance
uses 512 byte UDP packets. So the minimum MTU for speakfreely is 552 bytes.
The noauth option may be necessary with some newer distributions.
You could start the pppd form a boot (rc) script. However, if you do this, and the pppd dies, you are without a link. A more stable solution, is to start the pppd from /etc/inittab;
s1:23:respawn:/usr/sbin/pppd /dev/ttyS1 115200
This way, the pppd will be restarted if it dies.
Make sure you have a `-detach' option (nodetach on newer systems) though,
otherwise inittab will start numerous instances of pppd, will complaining
about `respawning too fast'.
Note: Some older systems will not accept the speed `115200'. In this case you will have to set the speed to 38400 en set the `spd_vhi' flag with setserial. Some systems expect you to use a `cua' instead of `ttyS' device.
The default route can be set with the defaultroute option or with the /etc/ppp/ip-up script;
#!/bin/bash
case $2 in
/dev/ttyS1)
/sbin/route add -net 0.0.0.0 gw Rem_Ip netmask 0.0.0.0
;;
esac
Ip-up can also be used to sync your clock using netdate.
Of course the route set in ip-up is not necessarily the default route. Your ip-up sets the route to the remote network while the ip-up script on the remote system sets the route to your network. If your network is 192.168.1.0 and your ppp interface 192.168.1.1, the ip-up script on the remote machine looks like this;
#!/bin/bash
case $2 in
/dev/ttyS1)
/sbin/route add -net 192.168.1.0 gw 192.168.1.1 netmask 255.255.255.0
;;
esac
The `case $2' and `/dev/ttyS1)' bits are there in case you use more than
one ppp link. Ip-up will run each time a link comes up, but only the part
between `/dev/ttySx)' and `;;' will be executed, setting the right route
for the right ttyS.
You can find more about routing in the
Linux Networking HOWTO section on routing.
Test the whole thing just like the modem test. If it works, get on your bike and bring the remote modem to the remote side of your link. If it doesn't work, one of the things you should check is the COM port speed; Apparently, a common mistake is to configure the modems with Minicom using one speed and then configure the pppd to use an other. This will NOT work! You have to use the same speed all of the time!
Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:19