These quick steps will enable you to setup dial-up networking on Linux in just five minutes.
You need the following packages:
wvdial*.rpm
ppp*.rpm
You can check with rpm -qa | grep -i wvdial for
the installed packages on redhat linux. Use equivalent package commands in case of
other distributions like Debian or Slackware.
The steps below are for MS Windows NT RAS server. The NT RAS requires
noauth in wvdial file. The Linux RAS may need different settings.
In the sample example given below, you should replace username john with the
user ID given to you to login into remote RAS server.
Edit the file /etc/wvdial.conf and insert lines like
Create a new file /etc/ppp/ip-up and insert lines like
#!/bin/bash
# This file /etc/ppp/ip-up should not be modified -- make local changes to
# /etc/ppp/ip-up.local instead
LOGDEVICE=$6
REALDEVICE=$1
export PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ -f /etc/sysconfig/network-scripts/ifcfg-${LOGDEVICE} ] && /etc/sysconfig/network-scripts/ifup-post ifcfg-${LOGDEVICE}
[ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local "$@"
exit 0
Create a new file /etc/ppp/ip-up.local and insert lines like
#!/bin/sh
echo " "
echo "Before doing route add......"
echo "Output from netstat -nr is : "
netstat -nr
echo " "
echo " Doing route add now.... "
# You should change the lines below and add the networks where
# your remote machines are ...
route add -net 156.15.24.0 netmask 255.255.255.0 dev ppp0
route add -net 172.28.36.0 netmask 255.255.255.0 dev ppp0
route add -net 172.28.39.0 netmask 255.255.255.0 dev ppp0
route add -net 172.28.26.0 netmask 255.255.255.0 dev ppp0
echo "After doing route add......"
echo "Output from netstat -nr is : "
netstat -nr
echo " "
When wvdial is started it automatically starts the pppd
which automatically calls this script to
add route to your remote networks via the PPP link.
See 'man pppd'.
In the example above I have to connect to remote networks 156.15.24, 172.28.36,
172.28.39 via the PPP link. You should replace these with your settings.
You can also manually add or delete the route after starting the PPP.
bash$ su - root
bash# route add -net 172.28.26.0 netmask 255.255.255.0 dev ppp0
bash# route del -net 172.23.2.0 netmask 255.255.255.0 dev ppp0
Create a new file /etc/ppp/ip-down and insert lines like
#!/bin/bash
# This file /etc/ppp/ip-down should not be modified -- make local changes to
# /etc/ppp/ip-down.local instead
LOGDEVICE=$6
REALDEVICE=$1
export PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ -x /etc/ppp/ip-down.local ] && /etc/ppp/ip-down.local "$@"
/etc/sysconfig/network-scripts/ifdown-post ifcfg-${LOGDEVICE}
exit 0
Create a new file /etc/ppp/ip-down.local and insert lines like
#!/bin/sh
echo " "
echo "Before doing route delete ......"
echo "Output from netstat -nr is : "
netstat -nr
echo " "
echo " Doing route delete now.... "
# Lines below should be same as in ip-up.local but with delete
route del -net 156.15.24.0 netmask 255.255.255.0 dev ppp0
route del -net 172.28.36.0 netmask 255.255.255.0 dev ppp0
route del -net 172.23.2.0 netmask 255.255.255.0 dev ppp0
echo "After doing route delete ......"
echo "Output from netstat -nr is : "
netstat -nr
echo " "
When pppd is stopped it automatically calls this script to clean up
whatever ip-up script did.
See 'man pppd'.
Edit /etc/ppp/peers/wvdial and insert lines like
noauth user john
name wvdial
Change john with whatever.
If you have an external modem, then just before dialing,
switch off/on the power to modem to reset it.
bash$ su - root
bash# tail -f /var/log/messages
Bring up another xterm shell window and
bash$ su - root
bash# man pppd
bash# man wvdial
bash# cd /etc/ppp
bash# nohup wvdial myconnection &
bash# tail -f nohup.out
Bring up another xterm shell window and
bash$ su - root
bash# ifconfig -a
And you should see ppp device listed and up and running.
bash# netstat -nr
And you should see ppp device listed along with other interfaces.
By this step the pppd should have established the routes
to remote networks with ip-up.local script. Also pppd should
have created the /etc/ppp/resolv.conf for DNS servers. Now, try connect to remote host
and verify connections.
bash$ su - root
bash# tail -100 /var/log/messages | less
bash# cat /etc/ppp/resolv.conf
bash# ifconfig -a
bash# netstat -nr
I looked for route to network 156.15.24.0 (You should see your
network as per /etc/ppp/ip-up.local)
bash# ping 156.15.24.68
bash# telnet 156.15.24.68
You can also edit /etc/hosts and add these hosts
156.15.24.64 starship
172.28.36.131 gemstone
bash# ping starship
bash# ping gemstone
bash# telnet gemstone
bash# ftp gemstone
To stop the PPP :
bash$ su - root
bash# killall wvdial
bash# killall pppd
bash# man killall
Now enable non-root user to do dial-up networking with PPP.
Make sure that the user belongs to the groups `uucp' and `dialout'.
bash$ su - root
bash# su - someuser
bash$ id
uid=501(someuser) gid=501(maingid) groups=501(maingid),503(staroffice),505(staff)
This shows the groups 'someuser' belongs.
bash$ exit
bash# usermod --help
bash# usermod -g maingid -G staroffice,staff,uucp,dialout someuser
bash# chgrp -R uucp /etc/ppp
bash# chmod -R ug+r /etc/ppp
bash# chmod -R o-rwx /etc/ppp
bash# chmod go-rwx /etc/ppp/*secrets
bash# chmod u+s /usr/sbin/pppd
bash# su - someuser
bash$ id
This will display groups someuser belongs and you should see uucp.
bash$ nohup wvdial myconnection &
bash$ tail -f nohup.out
It is very strongly recommended that you use wvdial as `normal' user, and make
sure that the user belongs to the groups `uucp' and `dialout'.
See also the frontend tool for wvdial at
X-wvdial.
If you do not have any other interface ethernet cards for Cable modem or
DSL modem then you can setup telephone dial-up modem as the default route for all outside
conections to internet. Assuming you only have modem connection via POTS (Plain Old Telephone
System) you can do -
bash$ su - root
bash# man route
bash# ifconfig -a
And look for the IP address of the ppp device, and use it below
bash# route add default gw IP_of_ppp_device
For example -
bash# route add default gw 172.28.36.3
bash$ su - root
bash# tail -f /var/log/messages
And then start myconnection in /etc/wvdial.conf
bash# wvdial myconnection
bash# ifconfig -a
Should list ppp
bash# netstat -nr
Should list ppp
If you have multiple interfaces, like ethernet cards to DSL or Cable modem,
to check which route is being used, do:
bash# traceroute www.yahoo.com
bash# traceroute remotehostname
Preference should be given the console line commands as in previous section, but
some people prefer GUI interface.
You can use graphical tools like Linuxconf, KPPP, GnomePPP and many others.
Note: I very strongly recommend using command-line console
commands 'wvdial' as demonstrated
in previous sections, as they are lot simpler and easy to use.
bash$ su - root
bash# linuxconf &
And select Networking->Client Tasks->Routing & Gateways->Set Other Routes to networks->Add network
. Also select Networking->PPP
bash# rp3 &
bash# rp3-config &