Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Jul 1998 12:22:58 -0700 (PDT)
From:      Archie Cobbs <archie@whistle.com>
To:        cpn@dpac.tas.gov.au (Carey Nairn)
Cc:        questions@FreeBSD.ORG
Subject:   Re: multilink ppp
Message-ID:  <199807151922.MAA23642@bubba.whistle.com>
In-Reply-To: <Pine.BSF.3.96.980716001658.23745A-100000@whitestar.cpn.org.au> from Carey Nairn at "Jul 16, 98 00:23:03 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Carey Nairn writes:
> I am having some headaches trying to set up mpd-1.0b4 from the ports.  The
> software install went fine but I am now trying to get the configs right
> to enable dialup to the ISP.  
> 
> The dialup is as follows:
> 
> - dynamic IP addresses  (I can't find the mpd equivalent of ppp.linkup
> where I would normally have something like 
> 
> delete ALL
> add 0 0 HISADDR

With mpd, you would do this like so:

  set iface addrs 1.2.3.4 5.6.7.8
  set ipcp ranges 0.0.0.0/0 5.6.7.8/0

That is, you have to set initial values, even if they are made up
(which is OK). Once connected, the server will assign the correct
addresses and mpd will renumber the interface.

> - standard username/password login so I need a standard expect/send chat
> script.

You can do this pretty easily using the mpd chat language..
here is an example of an "auto login" algorithm that Whistle uses:

##
## AutoLogin
##
## Here we attempt to figure out what the remote server wants
## from us. We do this by checking for bytes that correspond
## to PPP packets (in which case we are done) as well as common
## login type stuff like "name:", "ogin:", etc.
##
## This always returns. The hope is that when it returns, the
## remote side has reached PPP mode.
##
## This has been crafted from empirical evidence. Lots of terminal
## servers have various intelligent/stupid features which we
## take advantage of/have to work around.
##
## Variables (set automatically by mpd):
##
##  $Login		Authorization login
##  $Password		Authorization password
##

AutoLogin:
	log "Auto-login..."

# Spend at most this long doing auto-login before giving up

	timer autoLogin 5 AutoLoginTimeout

# At any time if we an LCP frame (not our own echo) then we're done

	match autoLogin "\x7e\xff\x03\xc0\x21" AutoLoginFrame
	match autoLogin "\x7e\xff\x7d\x23\xc0\x21\x7d\x21" AutoLoginFrame
	match autoLogin "\x7e\xc0\x21" AutoLoginFrame

# Now send a "fake" PPP frame (this is an empty config-reject with id# 172).
# This should trigger any auto-detecting servers to jump into PPP mode,
# which is good because it's faster (by avoiding human readable messages)
# and more reliable (PPP framing).

	print "\x7e\xff\x7d\x23\xc0\x21\x7d\x24\xac\x7d\x20\x7d\x24\x2e\x2b\x7e"

# Wait one second for server to auto-detect PPP or send a login prompt.
# After one second of neither, try sending a carriage return (some servers
# require this). After that, we have to see something recognizable from
# the peer, otherwise we'll just timeout.

	match "ogin" AutoLoginPrompt
	match "name" AutoLoginPrompt
	wait 1
	print "\r"
	match "ogin" AutoLoginPrompt
	match "name" AutoLoginPrompt
	wait

# At this point we've seen a login prompt; do the manual login

AutoLoginPrompt:
	log "Sending login..."
	print "${Login}\r"
	match "word"
	wait
	log "Sending password..."
	print "${Password}\r"
	match "\r"
	wait
	if $didLogin != "yes" match "ogin:" LoginAgain
	match ">"
	match "%"
	match ":"
	wait
	log "Sending ppp comand..."
	print "ppp\r"
	cancel all
	return

LoginAgain:
	set $didLogin "yes"
	goto AutoLoginPrompt

# We saw a PPP frame

AutoLoginFrame:
	log "Detected PPP frame."
	cancel all
	return

# We timed out before seeing a PPP frame

AutoLoginTimeout:
	log "Auto-login timed out."
	cancel all
	return

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807151922.MAA23642>