Jayjwa: you are right, AND Bjoern is also RIGHT.
You are an expert, while most readers will not understand one word of
what you have written, hardly able to do what Bjoern wrote without
trying to understand even that.
Dropping down other interfaces while dialing is the easiest way to
overcome the bitterness for a newcomer to Linux, who hardly knows what a
line command might be, to be unable to "surf".
Most of the time the issue is DNS, not the gateway, and handling that
automatically is quite possible because the dialup connection can be
taught not to use /etc/resolv.conf
Jacques
jayjwa wrote:
On Wed, 6 Aug 2008, Bjorn Wielens wrote:
With regards to eth0, it will need to be brought down
every time you want to dial. You could perhaps write a
small 3-line bash script that does this, then dials,
and when you press a certain key combo, disconnects
the modem and brings eth0 back up.
I'm just wondering why this is. On my external machine, which connects
using a linmodem to an ISP, I've 4 other interfaces one of which is an
ethernet (eth0). I've never downed any of them. Prehaps this is a
routing issue? In that case, you only need to set route to the host at
the other end of your dial up connection if it's your gateway. Come to
think of it, my eth0 is up at boot long before I get the kmod for the
linmode loaded, dialout, and get a ppp0 to work with.
If you're using pppd, you can also put commands in ip-up and ip-down
scripts in /etc/ppp. Those get run before and after pppd does its thing.
These are actually from the machine I'm on now, but are almost identical
to the ones I'm refering to (connecting the same ISP in the same way).
root> pppd call localnet
My nameservers are always set and don't change.
/etc/ppp/peers/localnet:
--------------------------------------
## Localnet.com
##
## PPPd peer connect script
lock
defaultroute
noipdefault
# Using the cellphone's built-in modem
#/dev/ttyACM0
# Using the Conexant Linmodem when we've the kmods for it
/dev/ttySHSF0
57600
crtscts
debug
noauth
passive
asyncmap 0
name "myusername"
connect "/usr/sbin/chat -v -f /etc/ppp/localnet-connect"
/etc/ppp/localnet-connect:
---------------------------------------
TIMEOUT 60
ABORT ERROR
ABORT BUSY
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
"" "AT&FH0"
OK "atdt2354500"
TIMEOUT 75
CONNECT
/etc/ppp/ip-up:
---------------------------------------
#!/bin/zsh
##
## This file /etc/ppp/ip-up is run by pppd when there's a
## successful ppp connection.
## Any commands you want printed to the screen should be directed
## to: >/dev/tty0
##
## The companion file is /etc/ppp/ip-down, it's run when the PPP
## connection ends.
##
## Parameter args:
## 1 = network device (ex: ppp0)
## 2 = device attached to (ex: /dev/modem)
## 3 = Speed of connection 57600 (ISP will rate limit this down)
## 4 = (your, eg, this host) local IP
## 5 = remote pppd IP address
# The environment is cleared before executing this script
# so the path must be reset.
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH
# Example parameters might be like so:
#Param 1: ppp0
#Param 2: /dev/modem
#Param 3: 57600
#Param 4: 64.179.15.96
#Param 5: 66.202.18.57
# Print results on screen, to logfile later at script end
echo "Connected $1 on $2 @ $3 bps. Local addr: $4 <--> Remote endpoint
addr: $5" > /dev/tty0
## The below commands are used on the gateway version of this script only,
## and not on this host. They are left for future examples only.
# Fix hosts file
#old_ip_addr=`awk '/^64.*atr2\.ath\.cx/ { print $1 }' /etc/hosts`
#new_ip_addr=$4
#replace "$old_ip_addr" "$new_ip_addr" -- /etc/hosts && logger -s -t
ip-up -p daemon.notice -- "Local IP set to $new_ip_addr: hosts file
updated."
# Fix Silcd's conf file (the daemon can't bind 0.0.0.0 for some reason)
#replace "$old_ip_addr" "$new_ip_addr" -- /usr/local/etc/silc/silcd.conf
# Update DNS at dyndns.org
#ddclient && logger -s -t ip-up -p daemon.notice -- "DNS updated: $1 -
$4 sent to dyndns.org"
# Clear nscd host's cache
nscd -i hosts && logger -s -t ip-up -p daemon.info -- "Nscd hosts cache
cleared"
# Restart everything that can't handle a changing IP address local server
for server ( rc.p0f rc.fl0p rc.silcd rc.proftpd rc.snmpd rc.ircd ); do
$server restart 1> /dev/null
usleep 400
done
# Write a system log only summery
logger -t ip-up -p daemon.info -- "Ip-up finished; $1 connected on $2 at
$3 bps "
#EOF
/etc/ppp/ip-down:
--------------------------------------
#!/bin/zsh
##
## This script is run by pppd after the PPP connection is ended.
##
## The companion file is /etc/ppp/ip-up, it's run when the PPP
## connection is started.
##
# The environment is cleared before executing this script
# so the path must be reset.
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH
# Just print some stats and a notice, log it
echo "\n\n ===[PPP Connection Close:End
Stats]=======================\n\n" > /dev/tty0
pppstats > /dev/tty0
logger -t ip-down -p daemon.info -- "Ip-down finished: PPP link closed."
##EOF
/etc/ppp/pap-secrets:
----------------------------------------
## PAP authentication file ##
## /etc/ppp/pap-secrets
## The "Server" name here needs be equal
## to the filename in /etc/ppp/peers for
## you do 'pppd call servername'
## Username Server Password IP addresses
myusername localnet mypassword *