Gentoo Wiki ArchivesGentoo Wiki

Dial-up

This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

That article lists the steps required to get your modem and dialup program(s) working.

Setting Up Modem

Firstly, you need to have a modem (obviously). However, not all modems are compatible with GNU/Linux, especially WinModems or software modems. External serial modems are highly recommended.

For more information about modems in Linux, please visit http://www.tldp.org/HOWTO/Hardware-HOWTO/modems.html

Detecting your Modem

This section needs work, however a useful script to use is called scanModem.

Setting up Serial ports

Usually, modems are connected to serial ports. Therefore, you must have your serial port(s) working properly before your system can recongize the modem. Make sure you have serial port support compiled into your kernel.

Linux Kernel Configuration: Serial Ports
Device Drivers  --->
   Character devices  --->
       Serial drivers  --->
           <*> 8250/16550 and compatible serial support

After you have compiled and/or make sure you have serial support into your kernel.

If you use external modem, you may need to probe the serial ports with minicom (emerge -a minicom) for the modem (usually located at /dev/ttyS[0-9]).

minicom
ATZ
ATI3
ATI4

The above commands will hang up the current connection and display modem information if modem is present. For more information on AT commands, please visit http://www.modem.com/glossary/extend2b.html


If you are using a PCI modem, run lspci as root to list all pci devices.

lspci

If you see your modem listed, congratulations! You can proceed to the next section.

HCF Modem

If your modem is a Rockwell/Connexant HCF pci modem, you would need to install the hcfpcimodem package:

emerge -av hcfpcimodem

Afterward, run hcfpciconfig, which will compile the hcfmodem modules. Follows the instructions in hcfpciconfig to set up your modem to /dev/modem.

HSF Modem

If your modem is a Connexant HSF modem, there is the hsfmodem driver by Linuxant (changelog). And you have three options:

  1. You can use the free trial version of the hsfmodem drivers, which are limited to 14.4K and has no fax support.
  2. You can pay about $20 to unlock those drivers (still no voice support) to run at full speed.
  3. You can use an unlocked OEM driver provided by Dell.

Free trial version

You would need to install the [Ebuild:net-dialup/hsfmodem|hsfmodem] package:

emerge -av hsfmodem

Afterward, run hsfconfig and follow the instructions, which will set up your modem to /dev/modem.

Full version

There is no ebuild, but you can rename the file, move it to the distfiles and redigest the above ebuild.

Unlocked full version

Dell provides for their customers an unlocked OEM driver.

You find an ebuild in this bugzilla entry. Download and extract it to your local overlay. Install it:

emerge -av hsfmodem-oem

Afterward, run hsfconfig and follow the instructions, which will set up your modem to /dev/modem.


All drivers bundles with its on version of ALSA. There may be compatibility issues if you try to run hsfmodem drivers that use different alsa code version from what you have installed.

You may find that you have no sound when the hsfmodem drivers are installed, but sound is restored by running the alsaconf script. This is solved by editing /etc/init.d/alsasound and specify that it should run after hsf:

File: /etc/init.d/alsasound
...
depend() {
   need localmount
   after bootmisc modules isapnp coldplug hotplug hsf
}
...

Finally add hsf to your runlevel:

rc-update add hsf default

Smart Link Modem

If your modem is a Smart Link modem, install the slmodem package and follows the instruction as prompted.

emerge -av slmodem

Winmodems with Lucent Apollo (ISA) and Mars (PCI) chipsets

If you are using Kernel 2.6.24, you will need to enable the deprecated pci_find_* API

Linux Kernel Configuration: pci_find_* API
Bus Options (PCI etc.)  --->
   [*] Enable deprecated pci_find_* API

If your modem is a Lucent Apollo or Mars winmodem, install the ltmodem package and follows the instruction as prompted.

emerge -av ltmodem

After emerge is complete run

modprobe ltserial

And check that the modules are present with

lsmod

Which would return this:

 Module       Size     Used by
ltserial     9904      3
ltmodem      555216    1 ltserial

If something goes wrong then proceed to the next section.

Compiling your own kernel

If the emerge did not work for installing the modem modules, then you have to compile and install and run a kernel yourself on your machine. This is especially the case with LiveCD installations, which copy the LiveCD kernel. This is because .config file for your kernel configuration and system.map do not exist yet, which is required for the winmodem modules to compile properly. This can be fixed by compiling a kernel on your machine and booting into your newly compiled kernel. There is alternative to it and that is to emerge linus-headers, but that is not guaranteed to work and it is not explained here. So proceed to the Kernel guide, once you have restarted with your new kernel emerge ltmodem again and it will install properly.

Setting Up Kernel for dialup

ppp module is used for dialup program, thus you must have ppp support compiled into your kernel or as modules.

Linux Kernel Configuration: PPP Support
Device Drivers  --->
   Networking support  --->
       <*> PPP (point-to-point protocol) support
       <*>     PPP support for async serial ports

or

Linux Kernel Configuration: PPP Support
Device Drivers  --->
   Network device support  --->
       <M> PPP (point-to-point protocol) support
       <M>     PPP support for async serial ports

If you compiled the support as modules, make sure you have loaded the module (either manually or in /etc/modules.autoload.d/kernel-2.6) before running the dialup program.

Also if you have ltmodem, disable SMP (Symmetric multiprocessing support), which would correct few errors with ltmodems.

Linux Kernel Configuration: Symmetric multiprocessing support
Processor type and Features  --->
         < >  Symmetric multiprocessing support

You can even try to disable this for other winmodms as well.

Setting Up the Dialup Program

There are several well known dialup programs: wvdial, kppp, ppp

wvdial

I found wvdial to be the easiest to deal with. First, emerge wvdial.

emerge -av wvdial

Afterward, run wvdialconf /etc/wvdial.conf to sample an initial configuration file. Edit the file and fill in the phone number, userid, and password. Maybe you also have to check your modem initialization codes (Init2 string). Just google your modem type.

wvdialconf /etc/wvdial.conf
nano -w /etc/wvdial.conf

Run wvdial (as root) and voila, you have your Internet connection.

wvdial

To allow all members of the dialout group to access wvdial, use visudo to edit the file /etc/sudoers:

visudo

To give all members of group dialout the required permission:

%dialout ALL=(root) NOPASSWD: = /usr/bin/wvdial

Now create a file /usr/bin/wvdialup with the following contents:

#! /bin/sh
sudo /usr/bin/wvdial $*

Type these commands:

chgrp dialout /usr/bin/wvdialup 
chmod 755 /usr/bin/wvdialup 

Add all users who need dialup access to the dialout group

gpasswd -a <user> dialout

kppp

kppp is another easy to use dialup program. Simply emerge kppp, run the program, and configure it as appropriate.

ppp

In case you didn't already know, the program responsible for doing the dialup negotiations with your ISP is called "pppd". So you should have merged this already (as root):

# emerge ppp

People new to Gentoo who are bandwidth challenged (including me!) will notice that after doing this, setting up your Dialup settings for your ISP in the usual way (such as with KDE's Internet Dial-up Tool), and then trying to connect: it doesn't work! You will get as far as making the phone call, hearing the two modems do their "artoo deetoo" thing, and then, when you get to "launching pppd..." it dies....

After playing around a bit (asuming you're not so frustrated by this that you decide to try another distro'...) you'll discover that it does work, so long as you are the root user.

The reason Dialup doesn't work out-of-the-box for non-root users in Gentoo seems to be that after merging pppd, Portage does not make the changes from the original "upstream" pppd install (that most other distro's do) to allow non-root users to dial the Net.

Since we have no trouble connecting to the Net as root, all that is really needed is to find the magic that allows a non-root user to do the same.


PPP and root pivileges

According to the PPP-HOWTO, "Because PPP needs to set up networking devices, change the kernel routing table and so forth, it requires root privileges to do this. If users other than root are to set up PPP connections, the pppd program should be setuid root"

So, the first thing to do would be this (as root):

# groupadd ppp
# chown root:ppp /usr/sbin/pppd
# chmod 4550 /usr/sbin/pppd
  • The groupadd command creates a new Unix group called "ppp". We will use this to control which non-root users may run pppd
  • The chown command makes sure pppd is owned by root in the first place (it should already be owned by root when you emerged it, but just to be sure...). It also sets the group ownership to our new "ppp" group.
  • The chmod command means this: "the /usr/sbin/pppd file may be run by root and by the ppp group as if they were root; but no-one else may touch it".

Now, the next thing to do (still as root) is to add non-root users to our new "ppp" group. You'll need to change the group list for each user who you want to allow Dialup. There is a nice, easy way to do this in Unix:

# gpasswd -a <user> ppp

Together with the changed file permissions, it means that <user> may now run pppd as if he were the root user.

Okay, now try connecting to the Net as your normal non-root user. Voila!

Happy Surfing...!

More info (hacking pppd)

Here are some tips to make your PPP a bit smoother...

Letting more than a few users run Dialup

If you have a bunch of people that you want to allow Dialup in this way, it can quickly get tedious (and error prone) to do the above groupsuser, usermod -Glist of groups plus new groupuser, over and over for each user.

So, I've hacked this script together, for adding a list of users to a group, which should do the trick:

Code: adduserstogroup
 #!/bin/bash
 # adduserstogroup  -- adds a bunch of users to a single group.
 # Ten-minute hack by Michael Lockhart, michael.lockhart@tpg.com.au
 # for use by sysadmin.
 #
 #  usage:  adduserstogroup grp usr1 usr2 ... usrn
 #  will add usr1...usrn to group grp
 #
 # AUTHORS:  Michael Lockhart (MJL)
 #
 # Version:  0.1
 #
 # Copyright 2005, Michael Lockhart.  You may use, copy, modify and distribute
 # this script under the terms of the GPL, ver. 2.0.  For details of the
 # GPL, please visit http://www.fsf.org/licensing
 #
 # NO WARRANTY.  This script is provided "as is" with no warranty.  If it
 # breaks your system, you get to keep all of the pieces.
 #
 # HISTORY
 #
 # MJL20050702 - Created.
 # MJL20050704 - Added a check that the group actually exists.
 #
 
 if [ $# -ge 2 ]; then
   if [ $UID == 0 ]; then
     egrep ^$1 /etc/group > /dev/null
     if [ $? == 0 ]; then
       GROUPNAME=$1
       shift
       while [ $# -gt 0 ]; do
         CURRENT=$1
         echo $GROUPNAME `groups $CURRENT` | sed 's/ /,/g' | usermod -G `cat -` $CURRENT
         shift
       done
     else
       echo "the group $1 does not exist."
     fi
   else
     echo "you must be ROOT to run this script."
   fi
 else 
   echo "usage:  $0 grp usr1 [usr2 ... usrN]"
 fi 
 

(hmm, maybe this belongs in Tips & Tricks too...)

Copy this file to your favourite text editor, save it, make it executable, and then run (as root) like this:

# chmod +x adduserstogroup
# ./adduserstogroup ppp bob joe mic

This adds the users "bob", "joe" and "mic" to our "ppp" group, allowing them all to use Dialup.

Security concerns

Of course, there is a reason that pppd was not made "setuid root" by default in Gentoo: "setuid root" programs are potential security holes.

You may think that pppd is a fairly mature program, that all it's holes have been plugged, and that any "back door" trick is easily spotted by other hackers who read the pppd source code, so that there is nothing to worry about. Well, sort of.

If you aren't careful, a user can make pppd run arbitrary programs by hacking their own ~/.pppd file. Because the program is "setuid root" it means that the user's arbitrary program will run with root privileges. Not a nice thing to allow, even if you "trust" your users today....

So, at a minimum, the NAG recommends that you'll want to prevent this attack by updating your pppd global configuration. Here's how:

File: /etc/ppp/options
connect  # force immediate connection to peer
noauth   # I don't know, but was recommended by the Linux Network Admin Guide...? 

NOTE:-- when I do this, I get immediate errors from pppd which then exits. So, I'll have to look into it a bit more... I think there must be parameters for these options... :-D

These are "privileged" pppd options, and can't be overridden by a user's ~/.pppd settings.

Of course, there are still ways to crack this (but I don't yet know them...). You may want to investigate the sudo package for a safer way to run pppd if you're bothered by it (or in an environment that needs it). But, for most home users and hobby hackers, this should be good enough.

Where to find more info

Check these resources out for more help with Dialup:

The best way: Gentoo's Network Configuration

Even easier than wvdial is to get set it up via Gentoo, though it takes a little more manual configuration.

I am going to assume that you have not made any big changes to /etc/conf.d/net and are ok with replacing it with /etc/conf.d/net.example because it is a lot easier than rewriting the file from scratch.

So...edit /etc/conf.d/net.example with your favorite editor and immediately save it over /etc/conf.d/net (after backing up the old /etc/conf.d/net in case things start dying)

Uncomment the following line about halfway down the file:

config_ppp0=( "ppp" )

Then, a few lines down, uncomment the following line and change it to where your modem is configured.

link_ppp0="/dev/ttyS0"    # Most PPP links will use a serial port

A few lines down, there is a place to specify your username and password that you use with your ISP. Specify the username but not the password, we'll do that in another file that's not world-readable.

username_ppp0='<your_ISP_username>'
#password_ppp0='password'

Then there's a whole chunk starting with pppd_ppp0=( and ending with a single ) that you need to selectively uncomment. I won't go over every option in detail, the comments are mostly self-explanatory. One thing you might want to enable is on-demand dialing and "updetach". The entrys "defaultroute" and "usepeerdns" are also recommended. To enable that, uncomment all the lines in that section. "Local and remote IP addresses" should be leave with comment.

The final things you need to do are set a phone number (right below) and uncomment the default chat script. The only thing in the chat script that you might want to change is the 'OK' command (which you should only uncomment the bottom one). If you want to disable the annoying modem speaker, you can do this:

'OK' 'ATQ0 M0 V1 E1 DT\T'

Then save the file.

Next, edit /etc/ppp/chap-secrets and add a line (if it doesn't exist already):

<ISP_username> * <ISP_password>

Escape any non-alphanumeric characters (meaning do a '\@' instead of a '@' and a '\.' instead of a '.', etc.)

Save that file and make sure it is readable only by root.

The final thing to do is to make a symbolic link from net.lo to net.ppp0 so you can actually start your dial-up connection.

# ln -s net.lo /etc/init.d/net.ppp0

To start it:

# /etc/init.d/net.ppp0 start

And like any other service, to make it start on bootup:

# rc-update add net.ppp0 default

Troubleshooting

After dialing was correctly and "ifconfig" will show you the ppp0 with the IP addresses which get from server, first ping your own addresses (local IP and remote IP). If that is fine but you can not ping some external web-sites, please check your /etc/resolv.conf and/or enable "usepeerdns". After this is OK but you will get "network unreachable" check with "route" your kernel IP routing table. If the ppp0 is not the default route you can activating this with "defaultroute" entry in the file "etc/conf.d/net".

See Also

External links

  • Linmodem Post Install Problems - This page is a very good compilation of the problems and solutions for linmodems after they have been installed. Its a must read for owners of linmodems.

Last modified: Sun, 24 Aug 2008 20:13:00 +1000 Hits: 40,343

Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.