Linux PPP Server & SEGA Dreamcast by MichaelG in November, 1999
You're reading a tutorial located at Kinox - The Emu Scene Dump, one of the most reliable source for news about the scene (pay us a visit, you won't regret!). This is a tutorial on configuring Linux so your Dreamcast can use the connection to play games. All rights reserved to MichaelG, its author. The following information is provided as is.  I take no responsibility for any damage you may cause to your PC or DREAMCAST console.  Also, please do not e-mail me with questions on how to set things up.  This page is provided for those who have a basic knowledge of Linux and its ability to do IP Forwarding and Masquerading.  It is ASSUMED that you are currently using Linux to connect multiple PC's to the Internet already. ALL INFORMATION BELOW IS BASED ON SLACKWARE with Linux Kernel 2.0.38, PPPD-2.3.10 and USR56K External Modem

Setting up a Linux PPP Server

After a week of playing around, I finally found the combination of what works and what is needed to properly set up Linux to act as a dial-up ppp server and allow my DREAMCAST console to access it.  What led me to actually work on this project was my desire to utilize my current method of Internet access (CableModem) because I just did'nt feel like tying up my phone line every time I wanted to use my DC on the Internet.  I know there are alot of users out there who have high-speed internet access such as CableModem or DSL, and alot of us would love to have a Broadband (Ethernet) Adapter for the DC.  This solution does not solve the high-speed acccess we want, but it does provide a solution to allowing us to utilize the CableModem/DSL access we already have.  This is even perfect for those of us who have multiple PC's accessing the Internet via Linux's wonderful ability to do IP Forwarding/Masquerading.  If anyone else besides me finds this info useful, then my job was done.

PLEASE, before you do anything, READ THE ENTIRE DOCUMENT FIRST!!!

If you're interested, my current setup looks like this:


 
 

The information I gathered came from a variety of sources.  I suggest you check out some of those web pages provided below.  They have proven invaluable to me in my quest.  Also, some of those pages will explain things in more detail than what I am willing to do here.

Perhaps the most comprehensive page on getting Linux set up as a PPP Server.
Gentry Information Distribution

A nice page on getting Linux set up to allow Winblows machines to dial into your Linux PPP Server.
Linux, mgetty & AutoPPP.

A nice page on getting Linux set up as a PPP Server for your own ISP service.
Start your own ISP

The above links have proven invaluable to me.  Please check them all out.  It will give you detailed information on setting Linux up as a PPP Server.  I will not provide information on how to set up Linux as a PPP Server, I will provide you with the addendums that need to be done to make your DC work with Linux.



Improving Performance

What led me to do this?? Well, I was tired of tying up my phone line everytime I wanted to access the Internet with my DC.  I thaught it wastefull.  I figured, If I could use my Linux box as a PPP Server, then I can take full advantage of the fact I can have unlimited time on the Internet with my DC without tying up that phone line.  Believe it or not folks, you can hook up two modems back-to-back by plugging in the the phone line cord in both the phone jack ports on the modem (not the phone-line).  By doing this, you can bypass the need for a Telephone company.  In addition, I wanted to take advantage of several features of Linux that would improve performance.

First, I use my Linux box as an HTTP Cache Proxy.  What this allows me to do is store some web page information on my Linux hard-drive that would allow me to access that same information repeatedly without having to retrieve it from the web site.  This works particularly well with web sites that have the same graphics daily.  For example, If I access a website with a background picture, Linux stores a copy of that picture on it's hard-drive.  The next time I access that same web page, Linux will compare the two images, if they are the same, then Linux will forward the localy stored copy to the Dreamcast rather than having the Dreamcast pull that image from the website.  This reduces overall transmission time.

The next thing I do is DNS Caching.  I use my Linux box as a DNS Server.  Linux also stores all the information on DNS queries localy.  Everytime I access a web site, Linux looks localy for the DNS query, if it's in cache, it speeds lookups considerably because I no longer have to request that DNS from my ISP.

The two programs I use are SQUID for HTTP Caching and I use Linux's internal ability to do DNS query/caching.

Information on SQUID can be found at  Squid Web Proxy Cache.

Information on setting up Linux's ability to DNS caching can be found at DNS HOWTO on www.linux.org.

If you are interested in performing the above features, then you should absolutely visit the above links.  I will not provide information on how to set it up.



Things that make it work

To start off, I am currently running Linux version 2.0.38 with PPPD daemon support compiled into the kernel using PPPD 2.3.10.  I would assume that PPPD 2.2.0f would also work just as well, but I have not tested it.  I also believe the DNS assignment convention is different.  In the older PPPD, you would use "DNS-ADDR" (or something to that effect) and the newer version you use "MS-DNS".  Plus there are some other differences.  I STRONGLY recommend you use PPPD 2.3.10 because the naming conventions I use in the options file concur with 2.3.10 (possibly all 2.3.x versions, but not sure).  You can find PPPD 2.3.10 by doing an FTP search for "ppp-2.3.10.tar.gz", that's how I found it.  If you are using the 2.2.x kernels and above, I think they already support PPPD 2.3.x.

Also note, that I use an external USR56K modem.  I'm sure it would work with other modems, but when I tried it with my old SupraFAX288 modem, it failed miserably.  This was almost guaranteed to be a setting option on the modem, but I did'nt feel like trying to fix it because it's garbage anyways.
 

To get Linux to work as a PPP Server, you need the Linux pppd daemon installed and your Linux kernel configured with IP Masquerade.  For information on doing this, you should visit the above sites regarding setting up a PPP Server.  In addition, you will need MGETTY.  This is an alternative to the UGETTY and AGETTY provided with Linux.  MGETTY was designed with PPP Server in mind because it will automaticaly call the PPPD Daemon when it recieves a call.  You can get a copy of MGETTY at Mgetty + Sendfax Documentation Centre .

You will also need a copy of UDPRED.  This is a UDP Port redirector.  It is required because when you log on to the Internet with your DC, the PlanetWeb browser tries to authenticate your user information on port 21050.  I've tried other UDP Port redirectors such as IPAUTOFW, but that seemed fruitless.  UDPRED worked fine for me.  You can get a copy of UDPRED at  http://www.wiznet.ca/~ambrose/udpred.c.gz . Just cut and past the text to a file and name it "udpred.c" and compile it by doing "cc -o udpred updred.c".  When finished, put "udpred" into one of your $PATHs.  I chose to put my file in "/usr/local/bin/".  You can store it anywhere, but later on, you will need to remember where you put it.

Now, assuming you have correctly set up your PPP Server (hopefully you tested it by having a windows machine log on).  Then you are ready for the next step.



Making it all work on Linux

Now that you have your Linux PPP Server set up and !tested!, I will tell you what changes need to be made.

When you set up your PPP Server, you created a file called "options" in the "/etc/ppp" directory.  You were told to put a line "asyncmap 0".  This line will not work for the DC.  You need to change that line to "default-asyncmap".  The DC and Linux don't seem to communicate after PAP-Authentication.  Well, in reality they do, but the DC does'nt understand what it's recieving. It took me a while to figure it out, but I used a program call "SPY" on my Linux PC that worked wonderfuly.  In fact, I was stumped on why it was not working until I used "SPY". Changing it to "default-asyncmap" will fix the problem.

My "/etc/ppp/options" file looks like this:

    debug
    default-asyncmap
    require-pap
    ms-dns aaa.bbb.ccc.ddd
    proxyarp

Notice ms-dns has been left blank.  If you use your Linux box for DNS queries, then you should place the address of your Linux's local Ethernet Adapter IP Address.  If you are not going to do DNS query within Linux, then you can place the IP Address of you ISP's DNS server.  If you have more than one DNS IP Address, you can add a second line of "ms-dns".  Alternatively, you can define this option on the DC where you put in the telephone number of your ISP and remove that line from the "/etc/ppp/options" file.  You can also remove the "debug" command from the line.  I recommend doing that after everything has been tested out so you don't fill up your log files.

Next, you need to double check your "/etc/ppp/options.ttySx" file.  Make sure that is what you want.  It will be the local PPP0 inteface IP Address as well as the DC's IP Address.
 

NOTICE: Below, you should probably use your REAL USER/PASS name that you use to logon to your ISP and retrieve E-Mail instead of PPPUSER and PPPTEST in both locations below.  Doing this will ALLOW you to get your E-MAIL!!!!!  Just add a valid user with your REAL USER/PASS to your Linux System!!!!

Everyone says you should remove the "/etc/ppp/pap-secrets" file.  I left it in and needed it!  My file looks like:

pppuser    *    ppptest    *

Both the pppuser and it's password ppptest were actually defined as valid users on my Linux system.  You can put there whatever you configured as a valid user to access the PPP Server when you configured/tested your PPP Server earlier, but I suggest your real ISP USER/PASS.  The PAP-SECRETS file is necessary for me because I did not issue the "noauth" command in my "/etc/ppp/options" file.
 

Next, most of them told you to add a user to something like this:

pppuser:x:1001:100::/home/pppuser:/usr/sbin/pppd

I actually left mine as:

pppuser:x:1001:100::/home/pppuser:/bin/bash

I did this so I can logon to my Linux box as a valid user through Telnet or FTP.

NOTICE: pppuser and ppptest is just someting I use as an example for this doc.  I actually use my real ISP USER/PASS.  This applies for both the passwd file and the /etc/ppp/pap-secrets file!!!

I DO NOT recommend you make a change in the "/etc/passwd" file directly.  Instead, use "adduser" or whatever else is available.  If you are using SHADOW passwords, you can screw things up and will need the BOOT/ROOT disk sets to get back on. Before doing anything, I would make backup copies of your "/etc/passwd" and "/etc/shadow" files.  I did "cp passwd passwd.GOOD" and "cp shadow shadow.GOOD" so I can always go back to square one if needed.

NOTICE: When making changes and going from shadow to unshadowed, I lost my passwd file twice!!  You should'nt need to change from SHADOW to UNSHADOWED, but I'm a hacker and hacked directly into my "/etc/passwd" file instead of the "adduser" command.  I had to boot up with a Linux Boot Disk, mount my /root directory to /mnt and copy over my old passwd and shadow file.  Before doing anything, I suggest you copy your "/etc/passwd" file to something like "/etc/passwd.GOOD" and "/etc/shadow" to "/etc/shadow.GOOD" this way, if you reboot, and cannot log back on, boot up with a BOOT/ROOT disk set, mount your /root directory under /mnt and recopy your /etc/passwd file.  Something like this: "mount -t ext2 /dev/hda1 /mnt".  Then go into the "/etc" directory, do a "cp shadow.GOOD shadow" and a "cp passwd.GOOD passwd".  Reboot and you can get back in and are back in SHADOW mode.  And start over.  I know this is a shitty hack, but hey, I'm not a Linux expert and personaly, everytime I F-UP, I learn something....  :)
 
 

Now we need to configure the UDPRED to work.  This is necessary.  When I initialy logged in, I had to go through the sign-up process again.  This was because of the way Linux works and handles UDP redirections.  Linux is a great machine for IP Masquerading, but it is horrible at handling UDP port redirections in my opinion (NOT sure of any technical reasons).  For some reason, the PlanetWeb browser sends a UDP packet to port 21050 at robin.planetweb.com.  I found this odd at first, but then realized that the PlanetWeb software is probably authenticating itself to PlanetWeb.  Hmmmm....I wonder why.... :)

You need to make a change in the "/etc/inetd.conf" file.  At the end of the file, add a line like this:

21050 dgram  udp  wait  root  /usr/sbin/tcpd  /usr/local/bin/udpred eee.fff.ggg.hhh 21050

Notice the "/usr/local/bin/udpred"? Thats because thats where I placed the file in my $PATH.  If you placed it elsewhere, you need to make the change.  Also, eee.fff.ggg.hhh is the IP Address you are going to assign to your DC.  This is the IP Address eee.fff.ggg.hhh that you put in the "/etc/ppp/options.ttySx" file. Noted as:

aaa.bbb.ccc.ddd:eee.fff.ggg.hhh

where aaa.bbb.ccc.ddd is the local PPP0 interface and eee.fff.ggg.hhh is the assigned IP Address for the device logging into the PPP Server.

After you added the line, you need to re-initialize your inted daemon.  You can do this by issuing the cammand "inetd -c".  I think that works.  If not, your best bet at this time is to just reboot your machine and move on to the next step.



Making it all work on Dreamcast

If you have already configured your DC for Internet access, then you could pretty much leave it alone.  The only exceptions are for USER/PASS.  Make sure they are identical to the authorized user/pass you used on your Linux PPP Server. Again, you should probably use your REAL USER/PASS name that you use to logon to your ISP and retrieve E-Mail.  Doing this will ALLOW you to get your E-MAIL on the DC!!!!!  Just add a valid user with your REAL USER/PASS to your Linux System!!!!

If you already have a "Dial Up Number" entered, you can leave it.  If not you should configure one.  I use a full seven digit scheme xxx-xxxx.  You will see why later.

The DNS addresses can also be changed at this time.  If you decided to issue the command "MS-DNS" in you "/etc/ppp/options" file, then you should leave all ZEROs in the IP Address fields.

Next, go to the "Dial Options" and change the setting "Dial" to TONE.  Next, change the setting "Blind Dial" to ON.....THIS IS IMPORTANT!!!

The last option you might want to change is the PROXY SETTING if you are going to use the SQUID/HTTP Caching feature.  That is straight forward.  Select "YES" for "Use Proxy". In the "Proxy Server Name", put in the IP Address of your Linux box, in the "Proxy Port" section, put the port number you are using.  The default for SQUID is 3128, unless you changed it!

Next option is to go to the "Display Options" and select "Show Verbose Modem Messages" to YES.

Thats it.  Now it's time for making the connection.



Making the Connection!

This is the easy part....Most people don't realize this, but you can actually connect the modems together back-to-back using the phone-line cord.  You see, if you tell one side to do a blind-dial, it will dial out and initiate the Connection Tone without checking to see if there is actually a Dial-Tone on the line.  If you force the other side to initiate an Answer Tone, the two modems will sync up because as far as they are concerned, a connection was made because they hear eachother!  Now, in truth, I don't know if this works with ALL PC Modems, but on my USR56K External modem, it DOES WORK!!!  I'm sure other modems can be coaxed to doing the same thing through some registry setting if needed.

So now, connect a phone-line cord to the back of the DC.  Connect the other end to the PHONE-JACK port on your PC modem. NOT THE PHONE-LINE port where you plug in your phone to talk to people!

Now, for the connection.  On your DC, initiate an Internet Connection by selecting "enter" on the Front Page of the Dreamcast PlanetWeb browser.

Watch the messages that come up. When you see the ATDTxxx-xxxx command, it's time to start counting down.  I count to about 7.  I do the following, 1 mississippee, 2 mississippee, 3 mississippee, etc. etc.  When you get to about 7, it's time to issue a command on your Linux PPP Server to tell it to answer the phone.  The reason why we count to 7 is because you entered a full 7 digit number in the options on your DC as xxx-xxxx.  It takes about 7 seconds before it completes the dial-out of the phone number and then goes into a Connection Mode Initiation.

NOTE: You could probably just use a single number like ATDTx or something and that would reduce the amount of time you wait before forcing Linux to answer the phone.  I have'nt tested this tho....

Next, you need to force Linux to answer the phone by modem. You do this when you issue a command:

killall -USR1 mgetty

What this does is send a SIGUSR1 to the MGETTY process already running.  This tells MGETTY to answer the phone line, initiate the ATA answer mode command, and NOT initialize the modem when doing so.

Now, if you timed everything correctly, you should make a CONNECTION!!!  You may need to try it a couple of times, but, it DOES WORK!!!

To recap, the step is, on one side, you tell the DC to dial out, you count to 7, then tell Linux to answer the phone.....Thats it!!!



Final Words

PROVIDING YOU HAVE YOUR LINUX PC SET UP CORRECTLY TO USE IP FORWARDING/MASQUERADING, EVERYTHING SHOULD WORK.  IF YOU DON'T KNOW WHAT LINUX IS, THEN YOU'RE TOO LAME TO EVEN TRY THIS....   :)

All kidding aside, Linux is a GREAT OS.  The ability to connect multiple PC's to a single ISP alone is worth looking into.  Especialy if you have high-speed internet access such as CabelModem or DSL.  I would'nt really recommend this to those who have just a DIAL-UP ISP service.  You can still do it, but it's not really worth the hassle.  The only real advantage to doing this for DIAL-UP users is that you can use your PC to browse the NET/IRC while your DC is also on the NET.

The only problem I see for the future, is on-line gaming.  Some games have a tendancy to use UDP/TCP ports that Linux does not work with.  If you come across this, just issue the command "ipfwadm -M -l" and look to see what ports are being called.  Then use the appropriate software to redirect those ports, such as UDPRED, IPPORTFW, IPAUTOFW, etc. Does the newer Kernels even use IPFWADM???


This information is free to all.  I take no responsibility for any damages you cause.  Especially if you screw up your Linux system and have to reinstall or spend hours fixing it.  If anyone has better ways of doing this, please tell all, and most importantly, tell me.  Anyone is free to distribute this information, just don't take credit for it. If you improve upon it, at least let them know where the initial work came from.

--MichaelG

][Mike][

PLEASE, DO NOT E-MAIL ME ASKING FOR TECHNICAL SUPPORT.  THIS PAGE IS "AS IS".  ALL I KNOW IS THAT THIS WORKS ON MY SYSTEM.  THE LINUX OS IS VERY DIVERSE.  I'M STILL AT KERNEL 2.0.38!!!

BTW, does someone want to hook me up with access to the Dreamcast Technical Pages ?? Unfortunately, registration is closed..... :(


Back to Kinox Articles
Read the latest news @ Kinox