NOTE: This is a ported post from the old Mutaku site. Original post information:
Tuesday, June 19 2007 @ 06:20 PM EDT Contributed by: xiao_haozi
My dirty walk-through to setting up an external modem in Linux using wvdial to dial into an ISP connection.I had some trouble finding a single place with a good write-up for doing such a task when I was setting up a Linux box for someone that had previously been using Windows and a little OS X. Finding dialing info, modem configuration, or slight troubleshooting, alone wasn’t too difficult, but finding them in one place in a concise manner was. So I have attempted to compile what I have found, my tweaks and adjustments, and other hints that enabled me to setup a Linux box to use a dial up connection via external modem.
As I mentioned, information for this task was extremely piecemeal, and finding any form of updated support for a modern Ubuntu distribution (Feisty Fawn – Kubuntu in particular) was like searching for a pay phone in Hollywood, or so I imagine. Similes aside, most of the information I could locate was for workarounds with internal winmodems (or lack thereof), or even the, “…yeah, why are you still trying to use dial up?” Regardless of the archaism of the technology, America is apparently still clinging to this method of exploration as evident by googling some statistics on broadband penetrance.
So there I was left with a monumental task for my new school networking knowledge (setting up firewalls, DHCP, NAT, whipping up some cat5, etc) and burgeoning Linux skills. In the end, I could hear that clunky, mystical modem speaker cranking away, and yes, the sweet, sweet splendor of waiting eons for those jpegs to load in my Google image search. Away we go —
The hardware and tools I had available were as follows (with a little explanation why where relevant):
* Linux box (AMD64) : trying to switch them to a free framework (and that which I find most fun)
* Kubuntu Feisty Fawn 7.04 (64bit version) : running KDE of course (I find KDE to be a little more user friendly for those coming from windows — bring on the flame war — but that is just mho)
* A few sporadic guides (I truly apologize for my lack of references but it I will try to add a list of sorts at the end)
* external modem : Trendnet TFM-560x v.92 56k serial modem (because internals are a pain to find — at least in my house — and most of mine were winmodems from scrapped dell boxes which use proprietary drivers from conexant — and because external modems are sexy)
* PCI serial card : Syba PCI multi I/O PCI 2 serial nm9835cv netmos dual ports (because the Asus motherboard I was building with didn’t have a serial port onboard — only Parallel — and I didn’t want to fight with a serial2usb approach)
* some command lines tools you will see during the guide
[WARNING: the guide to follow is what worked for me and is probably pretty crude and round-about. If you have a much more coherent and pretty way to do this, please leave comments for the others and myself. I am merely a computer hobbyist and a professional in any sort of computer related field by no stretch of the imagination (biochemistry to be specific) and accordingly this may be a little crude and ugly to some. Like I said, my Linux skills are not Jedi so bear with me please!]
First we need to find out where the PCI card is located and what the address of the serial ports are — we can do this many ways but I like to first check to see that the card is recognized and the like:
$ lspci -vv
We are looking for a ‘netmos’ PCI card and should see some info about it there with 5 regions listed all under the serial controller. You can also try scanpci if you wish.
Now we need the hex port address for the 2 serial ports on our card — I like to use dmesg and scan for it:
$ dmesg | grep "irq = 17"
You should see ttyS2 and ttyS3 entries — for example:
0000:04:09.0: ttyS2 at I/O 0x9c00 (irq = 17) is a 16550A
‘ttyS2’ tells us where — ‘0x9c00’ tells us the hex-port ID — and ‘16550A’ tells us the type.
So we can rerun this command by hitting up and then appending an output to save it to a file for reference:
$ dmesg | grep "irq = 17" > port_locations
We next need to install the tool to set the serial ports if we don’t already have it:
$ sudo apt-get install setserial
Since we now know where our PCI and serial ports are located we can set them to be used as follows by referencing our port_locations file we outputted the grep to (note: I have assigned both ports to the modem for ease in case it gets switched when I give it to the users. However, if you are going to be using this for something else keep that in mind — I haven’t tested it out, but I would make the broad assumption that setting both serials now shouldn’t affect adding in a scanner, let’s say, as long as the speeds are compatible and we have told the /dev/modem link to look at the right one):
$ setserial /dev/ttyS2 port 0x9c00 UART 16550A irq 17 Baud_base 115200
$ setserial /dev/ttyS3 port 0x9800 UART 16550A irq 17 Baud_base 115200
Now we will check that each is linked appropriately:
$ setserial /dev/ttyS2 -a
/dev/ttyS2, Line2, UART: 16550A, Port: 0x9c00, IRQ:17
Baud_base: 115200, close_delay: 50, divisor: 0
Flags: spd_normal skip_test
$ setserial /dev/ttyS3 -a
/dev/ttyS3, Line2, UART: 16550A, Port: 0x9800, IRQ:17
Baud_base: 115200, close_delay: 50, divisor: 0
Flags: spd_normal skip_test
Since we have plugged in our modem into the left most (closest to the motherboard) we are using ttyS2 so we will link this to /dev/modem for our dialer program to use (of course this is if you plugged your modem into the serial port closest to the mobo):
$ sudo ln -sf /dev/ttyS2 /dev/modem
and check it:
$ ls -l /dev/modem
lrwxrwxrwx 1 root root 5 2006-05-11 15:40 /dev/modem -> /dev/ttyS2
On reboot, this link we just created will be reset to the original location, i.e. something other than where our modem truly is located. So we need have this linked on startup and we can therefore create an init.d script to do such:
$ cd /etc/init.d/
$ sudo nano modem-link
# modem-link : fix the /dev/modem link on startup
ln -sf /dev/ttyS2 /dev/modem
Set the execute bit and allow it to run at startup:
***** IMPORTANT: don’t forget that period after 99 2 3 4 5 when doing the update-rc.d below *******
$ sudo chmod +x modem-link
$ sudo update-rc.d -f modem-link startup 99 2 3 4 5 .
Now ones inclination would be to fire up KPPP or GPPP and use the gui to configure the dial up options. However, (at least in my build — and apparently most — see ubuntuforums.org) KPPP does not work. I managed to get it so far as to see the modem and attempt to dial, however the dial sequence was weird and would not dial properly. I really wanted a gui for this part because the users I was building this for would be dialing up and are not comfortable with the command line yet. And I wanted things to be simple – I didn’t want connecting to the internet to scare them from Linux back to windows or OS X. However, I knew that the easiest way (i.e. the most trouble-free method) would be to use a command line dialer and then script it somehow, so for now there interaction with the terminal would be a little less daunting. Let’s move on to my favorite command line dialer, wvdial.
Let’s get wvdial if we don’t already have it:
$ sudo apt-get install wvdial
Now we need to give wvdial our ISP information in the config file:
$ sudo nano /etc/wvdial.conf
Phone = (your ISP number)
Username = (your ISP username)
Password = (your ISP password)
New PPPD = yes
Now lets use a KDE style launcher to do the launching of wvdial:
Open the Kmenu for editing and choose to add a new program.
We will name it (isp_name_here)-dialup, choose an icon of your liking, and then under the execution portion enter:
also choose to run in a terminal.
Now save it and exit.
To dial up now, all we have to do is find our little launcher we just made in the Kmenu, run it, and it will prompt us for our user password. Type in the password for the current user and you will see wvdial running in a terminal window. Once you see that you have acquired your IP address it will pause there and you should be ready to roll. Minimize your terminal window that wvdial is in and off to the races you go (well maybe not races as we are using dial up — maybe off to bingo?! we go).
Now to exit from our internet excursions and get our phone line back — maximize the terminal window and type ctrl-c (control + c) and this will exit wvdial and thus the connection.
So there you have it: a possibly very round-about way to get your dial up going. I found it to be a very elegant method. However, I am sure that reading through this, many have cringed, spit coffee at their monitors, or deleted my page from their bookmarks. But it worked for me and taught me some fun things about port assignment, writing startup scripts, and the like. I would appreciate your feedback: what worked, what didn’t work, did you do it another way, etc.
Good luck — modems ahoy~!