Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Sep 1995 11:32:37 +0100 (MET)
From:      Christian Kratzer <ck@toplink.de>
To:        hackers@freebsd.org
Subject:   pppd server with dynamic ip assignment
Message-ID:  <199509241032.LAA01183@toplink1.toplink.net>

next in thread | raw e-mail | index | archive | help
Hi All,

Some time ago I hacked a small Extension to pppd that has been performing
quite well.  I would like to contribute it to freebsd.

We are a small isp using freebsd machines for everything including dial up
servers.  Some of our customers get the same ip number every time they
connect others get assigned ip numbers dynamically. Additionally we have
several pools of ip numbers for different classes of customers.

To support this we give each user an account with pppd as the login shell.
They additionally get a .ppprc in their home directory.
pppd is NOT included in /etc/shells so they can't use ftp to upload .rhosts
or .ppprc files (or do other nasty things I dare not even think about ;-) )

The .ppprc file follows one of following patterns:

	# .ppprc ( set user specific ppp options )
	# customer is assigned ip from guests pool every time he connects
	ip-address-map ip-addr.guests

	# .ppprc ( set user specific ppp options )
	# customer is assigned ip from guests pool every time he connects
	ip-address-map ip-addr.toplink

        # .ppprc ( set user specific ppp options )
	# customer gets same ip everytime he/she connects
	:machine.customer.domain

The file specified in the ip-address-map directive specifies the name 
of a file under /etc/ppp/options.  This file maps each tty port to an
ip number effectively implementing dynamic ip assignment.

	#
	# IP Address Map for Dynamic PPP
	#
	# contains IP addresses for dialin to toplink
	#
	#       ip's of local and remote hosts
	#       local ip must be different from one
	#       you assigned to the ethernet ( or other )
	#       interface on your machine.
	#       remote IP is ip address that will be
	#       assigned to the remote machine
	#
	ttyd0   :ppp-005.toplink.net
	ttyd1   :ppp-006.toplink.net
	ttyd2   :ppp-007.toplink.net
	ttyd3   :ppp-008.toplink.net
	ttyd4   :ppp-009.toplink.net
	ttyd5   :ppp-010.toplink.net

After fighting with the broken proxyarp option in pppd for two weeks we now 
implement proxy arp using the following ip-up and ip-down scripts.

/etc/ppp/ip-up:
	#!/bin/sh
	# $1 ifname,$2 devname,$3 strspeed,$4 strlocal,$5 strremote
	/usr/sbin/route delete $5
	/usr/sbin/arp -d $5
	/usr/sbin/arp -s $5 `cat /etc/ppp/ether_addr.ed1` pub

/etc/ppp/ip-down:
	#!/bin/sh
	# $1 ifname,$2 devname,$3 strspeed,$4 strlocal,$5 strremote
	/usr/sbin/arp -d $5
	/sbin/ifconfig $1 down
	/sbin/ifconfig $1 delete 

This scheme has been working just fine for 6-8 weeks now and I think
it's ready for release. The changes to pppd are quite local. I did check
with freebsd current before I did the hack in 2.0R that there had been 
no changes to pppd.   

I will gladly volunteer to report this hack onto the newest pppd together
with the person currently responsible for the thing. I could also write a
section for the freebsd manuals detailing use of this feature for a pppd
server.

I do also have a question for hackers that might be a good thing to solve
once we are at it.  Every time a users disconnects from pppd we get a list
of error messages to the console. Is this a bug with 2.0R ?  

	Sep 23 21:28:15 mail pppd[25600]: ioctl (PPPIOCGFLAGS): Inappropriate ioctl for device
	Sep 23 21:28:15 mail pppd[25600]: ioctl (PPPIOCGFLAGS): Inappropriate ioctl for device
	Sep 23 21:28:15 mail pppd[25600]: ioctl(PPPIOCSASYNCMAP): Inappropriate ioctl for device
	Sep 23 21:28:15 mail pppd[25600]: fcntl(F_SETFL, fdflags): Inappropriate ioctl for device
	Sep 23 21:28:15 mail pppd[25600]: ioctl(TIOCSETD): Inappropriate ioctl for device
	Sep 23 21:28:15 mail pppd[25600]: tcsetattr: Inappropriate ioctl for device

ps: please also cc me in your replies to the list as I am not quite sure
I get everything from the mailing lists.  Had some trouble in the past ;-(

Greetings
Christian Kratzer
-- 
TopLink GbR, Internet Services					info@toplink.de 
Christian Kratzer					 http://www.toplink.de/
Phone: 	+49 7452 87174
Fax: 	+49 7452 87175		FreeBSD spoken here!



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