Contributed by jose on from the make-your-own-ISP dept.
So why do it?
Well, we didn't want a real dialup server. That requires expensive T1 PRI or DSS lines. Those devices also usually require some kind of RADIUS authentication database. A cheap good T1 dialup server on ebay is around $1000 for an Ascend box or a couple hundred bucks for a Livingston Portmaster 3. Personally, I hate the Livingston ComOS. But, more to the point, we don't want to spend $400-$600/mo for a PRI line. We could have gotten a cheap Livingston 2 and plugged in external modems or something. But at that point, I'd rather use an OpenBSD box."
But you lose if you don't have a digital connection!
Sure, that's the downside to a simple group of modems on a PC. Unless you are connecting to a digital line (ISDN BRI, ISDN T1 PRI, or T1 DSS) then you don't get the opportunity to provide 56Kbps service, your limit is 33.6Kbps. Hey, no big deal. The goal for us is to be able to give folks dialup access for FREE with their real internet connection. Our customers started saying, "hey, I had FREE dialups with my last provider, don't you have something?" They aren't using it as their primary Internet connection, it's just to check email from home or on the road.. So, we are willing to live with this limitation. Another limitation is that without a real dialup server, it's hard or impossible to determine what speed people are connecting at.
But I digress..You may want to setup a dialup server just so you can hit your Unix-like shell from a payphone out in the middle of nowhere with the test pad on your lineman's handset... Who knows what us Unix freaks out there want to do...
Down to the nitty-gritty
My configuration is as follows: Four ISA modems. All are USR Sporsters, I tried some Rockwell chipset ISA modems but they were just trash. The TI chipset Sportsters worked every time. The PC is an older Celeron 300A with 64MB of RAM and a 12GB disk.
Here's how I did it. First, I configured the modems to play ball. I went into each modem like this: cu -s 115200 -l /dev/cua00 (or 01, 02, ...)
ATZ ATQ2E0&B1&C1&D3&S1&H1&I0&K1&R2S0=1S2=255 AT&WFor those unfamiliar with cu, you can use tilde-dot to exit the session. If you are connecting in through ssh, two tildes are required, one to escape the ssh session, and the second one is then actually passed on to cu. These AT commands set a number of important settings. ATZ sets the modem to factory defaults. AT&W actually saves the settings so the modem always uses them. We want all the modem control, line control, flow control, that way OpenBSD knows when a call starts and stops. The flow control is nice since OpenBSD is talking at 115200 but the modem will connect at variable speeds on the other side. My notes on the actual modem settings are stored in the system's /etc/motd: (Note if your sportster modems have dip switches, make sure they are all set to give you software based control)
Q2 - Result codes only for outgoing (Q1 Disable result codes; Q0 Enable result) E0 - Disables local character echo &B1 - Fixed DTE speed (&B0 floating DTE) &C1 - Modem controls CD (&C0 CD always ON) &D3 - Reset ON DTR loss (&D2 DTE controls DTR, D1 command mode) &S1 - Moden controls DSR (&S0 DSR always ON) &H1 - CTS TX Flow Control (&H0 Disable TX FC, &H2 Xon/Xoff TX FC) &I0 - Disable RX Flow Control (&I1 Xon/Xoff) &K1 - Auto Data Compression (&K0 Disable comp, &K2 Enable comp, &K3 Selective) &R2 - RX to DTE/RTS high (&R1 Ignore RTS) S0=1 - One ring before answer S2=255 - Escape code char 255
Next, I configured /etc/gettytab to lock the serial port at 115200, timeout after 30 seconds of inactivity in the pre-login phase, setup the TTY control flags, TTY input flags, TTY local flags, TTY output flags, do flow control based on carrier signal, use no parity, and start the PPP program of my choice if getty noticed an LCP packet being sent by the calling party.
pppd.115200: :sp#115200:to#30:c2#0245400:i2#025402:l2#02713:o2#07: :mb:np:pp=/usr/sbin/pppd:I use pppd because I'm familiar with it. I used it on SunOS for a few years, and later on OpenBSD when I was dialing up from it. Some of you prefer user-land ppp and that's fine too, it should be usable, but I'm going to show you how I used pppd.
These TTY flags in the c2, i2, l2 and o2 settings are supposed to enable RTS/CTS and various modem control features. These were gleaned from the mailing list, and work very well for me. I am unable to locate documentation which explains exactly what they do.
What does it mean to start PPP on an LCP packet? Well, it means that if you dial in with a terminal program, or a terminal itself, you are not going to be thrown into PPP. You are going to get the OpenBSD login prompt. If you dial in with a PPP client, it will send PPP LCP packets, getty will recognize that, and start pppd.
So, the next step after gettytab is configured to your specifications, the next step.... Decide which ttys are part of your dialup. I have four ISA modems, and ISAPNP wasn't working very well, because it was choosing conflicting IRQs to non-PNP devices which it had no way of knowing were already using the IRQ for other purposes. So, I set the modems up manually, using the jumpers, and used config -e to match up the kernel.
pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo pccom1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo pccom2 at isa0 port 0x3e8/8 irq 5: ns16550a, 16 byte fifo pccom3 at isa0 port 0x2e8/8 irq 7: ns16550a, 16 byte fifoNext, I asked /etc/ttys to play nice:
tty00 "/usr/libexec/getty pppd.115200" vt100 on tty01 "/usr/libexec/getty pppd.115200" vt100 on tty02 "/usr/libexec/getty pppd.115200" vt100 on tty03 "/usr/libexec/getty pppd.115200" vt100 onSee how that tells getty to use the pppd.115200 entry from gettytab? Next, just tell init (always pid 1) to HUP... kill -1 1
Now gettys are listening on the dialup and PPP needs to be configured. Here's how pppd works. It reads /etc/ppp/options.TTYXX when it detects a connect on TTYXX. So I setup several nearly identical /etc/ppp/options.ttyXX files.
115200 172.16.0.1:172.16.0.10 lock auth usehostname modem crtscts ms-dns 18.104.22.168 ms-dns 22.214.171.124 domain nmedia.net pap-timeout 60 deflate 15,15 bsdcomp 15,15 idle 1200As you can see, pppd takes a relatively free form configuration file. Here we tell pppd to pay attention to modem control signals, RTS/CTS flow control, we tell it to assign dome DNS servers and a domain name, we tell it to timeout if the user doesn't authenticate in 60 seconds, and we turn up compression to the max. We set a session idle time of 1200 seconds... We tell pppd to lock the tty..We tell it to require authentication...And we tell it what IP address to use on this tty.. 172.16.0.1:172.16.0.10 tells it to use the machine's IP of 172.16.0.1 for one end of the Point-to-Point link and 172.16.10.10 for the client's end. Since pppd doesn't have an address pool option, this is the next best option. Just tell it to use a different address, depending on the tty the user connects into. Obviously, the IP address increases, in options.tty01 it is 172.16.0.11, in options.tty02 it is 172.16.0.12, etc...
Next, you'll need to enter the PPP authentication data somewhere. Enter /etc/ppp/pap-secrets:
# client server secret IP addresses jimbo * yeehaw * sourceoflabor * stolenlives *All I do to add a user and password is put in the username, asterisk, passord, asterisk... This is the closest way I could figure to configure pppd to act like a typical ISP dialup server. Finally, I did rm /etc/ppp/chat-secrets and then ln -s /etc/ppp/pap-secrets /etc/ppp/chat-secrets. That way, if the user uses PAP or CHAP, they will be able to authenticate.
You don't need an /etc/ppp/options file, just /etc/ppp/options.tty00, /etc/ppp/options.tty01, etc... Just make sure you DO have an options file for every device that you are configuring for users to dial into. And each one needs a different IP address.
To wrap it up, you also need to set sysctl -w net.inet.ip.forwarding=1 because after all you ARE using this feature with a PPP client. You set this permanently in /etc/sysctl.conf. If you have questions about any of this, gettytab, tty, and pppd all have manual pages.
So, this is all you need to do if you want dialup on the cheap. It has proven to be ultra-reliable for me. You can dial in with a terminal or a PPP client this way. You could even do SLIP through a scripted login (SLIP doesn't have anything like LCP or PAP to automate the process) or UUCP transfers. Wow, what a throw-back to last century :) There's a lot more depth to what's going on here than I describe, obviously...So you might want to read up on the modem configurations, on serial lines and associated modem and RTS/CTS flow control, pppd, and if you have documentation or a pointer to the right source code to understand those i2, l2, etc TTY control flags, I would be curious to see it...
For the rest of you with fiber to your bathrooms, this at least shows you how it was once done
(Comments are closed)