This document covers my experience configuring a Toshiba Satellite
Pro 400CS laptop computer running RedHat Linux version 6.0. Other systems
and linux versions may require different procedures than those described
here. Any multi-user system would probably need to install things differently
and worry about some security issues that I don't care about since I am
the only user, usually logged in as root.
My system is primarily used for web application development. I normally am NOT connected to the internet and need to test html pages and scripts which access my internet domain name within this disconnected environment. I run the Apache http server on the laptop and access my domain, www.proliberty.com, at the localhost IP address: 127.0.0.1. Obviously, the static IP addressof my domain, on the internet, is different from localhost, so when I connect to the internet and want to access www.proliberty.com, my hosts file configuration must change.
My needs were very simple and require no fancy gateways, firewalls or other connectivity issues. I do not understand DNS administration well and have only learned enough to manage to do what I need. I simply require switching between two distinct states:
Hardware: line (modem) speed = <your modem speed>; modem port = /dev/modem Communication: init string = ATZ; modem dial dial command = ATDT<your ISP dial-up phone number>; other script items for loggin on (send/expect).... (see man pppd or man chat for details on connect scripts) Quit linuxconf; when prompted, choose 'activate changes'
chmod 755 /usr/sbin/pppup chmod 755 /usr/sbin/pppdown
127.0.0.1 localhost
domain proliberty.com
search proliberty.com
# I don't run any nameservers locally when not connected to the internet
domain proliberty.com
search proliberty.com
# Substitute the nameservers you use; these are from oro.net :
nameserver 198.68.62.2
nameserver 198.68.62.42
# /usr/sbin/pppup
# Edit these values for your own case in the chat command, below:
# <USERNAME > replace with your username
# <PASSWORD> replace with your password
# <MODEM_SPEED> replace with your modem speed
# <ISP_DIALUP> replace with your isp dial-up number
# WARNING - if you have multiple users on your system, it is probably
not a good idea to put
# username and password in this file if it is readable by others!
# copy config file templates needed for pppup state:
cp -f /etc/hosts.pppup /etc/hosts
cp -f /etc/resolv.conf.pppup /etc/resolv.conf
# start the PPP process and dialup your ISP
# your ISP's login procedure may be different from this.
pppd connect 'chat -v "" ATDT <ISP_DIALUP> CONNECT "" ogin: <USERNAME
> word: <PASSWORD>' \
/dev/modem <MODEM_SPEED> noipdefault
debug crtscts modem defaultroute
#!/bin/sh
#/usr/sbin/pppdown
# by Ian Goldberg <iang@cs.berkeley.edu>
# modified by Greg Keraunen <gk@proliberty.com>
# restore config files to pppdown state:
cp -f /etc/hosts.pppdown /etc/hosts
cp -f /etc/resolv.conf.pppdown /etc/resolv.conf
######################################################################
#
# Determine the device to be terminated.
#
if [ "$1" = "" ]; then
DEVICE=ppp0
else
DEVICE=$1
fi
######################################################################
#
# If the ppp0 pid file is present then the program is running. Stop
it.
if [ -r /var/run/$DEVICE.pid ]; then
kill -INT `cat /var/run/$DEVICE.pid`
#
# If the kill did not work then there is no process running for this
# pid. It may also mean that the lock file will be left. You may wish
# to delete the lock file at the same time.
if [ ! "$?" = "0" ]; then
rm -f /var/run/$DEVICE.pid
echo "ERROR: Removed stale pid file"
exit 1
fi
#
# Success. Let pppd clean up its own junk.
echo "PPP link to $DEVICE
terminated."
exit 0
fi
#
# The ppp process is not running for ppp0
echo "ERROR: PPP link is not active on $DEVICE"
exit 1