Wie Datenvolumen auf ppp0 bestimmen

Florian Lohoff flo at rfc822.org
Fri Jun 17 13:26:03 CEST 2005


On Fri, Jun 17, 2005 at 01:05:12PM +0200, Pierre Bernhardt wrote:
> Florian Lohoff schrieb:
> >On Wed, Jun 15, 2005 at 07:00:28PM +0200, Pierre Bernhardt wrote:
> >
> >Ich sehe im /var/log/syslog sowas:
> >
> >Jun 15 04:04:01 pobox pppd[28570]: Terminating on signal 15.
> >Jun 15 04:04:01 pobox pppd[28570]: Connect time 1151.1 minutes.
> >Jun 15 04:04:01 pobox pppd[28570]: Sent 109013520 bytes, received 
> >340433569 bytes.
> >Jun 15 04:04:01 pobox pppd[28570]: Script /etc/ppp/ip-down started (pid 
> >14595)
> Jetzt habe ich es gefunden. Leider aber für mich nicht brauchbar, da kein 
> ppp1
> oder ppp0 in der Nähe steht, da ich 2 aktive Routen habe.

*patsch* Dann guck mal hin - Da steht eine process ID die fuer die
gesamte session gleich bleibt:

Jun 17 03:36:07 pobox pppd[31107]: Serial connection established.
Jun 17 03:36:07 pobox pppd[31107]: using channel 577
Jun 17 03:36:07 pobox pppd[31107]: Using interface ppp0
Jun 17 03:36:07 pobox pppd[31107]: Connect: ppp0 <--> /dev/pts/0

Jun 17 04:04:01 pobox pppd[31107]: Terminating on signal 15.
Jun 17 04:04:01 pobox pppd[31107]: Connect time 27.3 minutes.
Jun 17 04:04:01 pobox pppd[31107]: Sent 0 bytes, received 0 bytes.

Mal davon abgesehen das die ppp0/ppp1 debatte hinfaellig ist da die
nummern beliebig vom kernel nach "first come/first serve" vergeben
werden.

Wenn du das fuer die zukunft haben willst kannst du dir auch eine
"ip-down" script bauen. Das bekommt die werte per environment variable
reingereicht.

Hier ein bespiel ein "set >/tmp/file" im ip-down:

BYTES_RCVD=27198
BYTES_SENT=49703
CALL_FILE=secure
[...]
IFNAME=ppp0
IPLOCAL=195.71.14.242
IPREMOTE=195.71.126.67
[...]
PPID=15122
PPPD_PID=2586
PPPLOGNAME=root
PPP_IFACE=ppp0
PPP_IPPARAM=secure
PPP_LOCAL=195.71.14.242
PPP_REMOTE=195.71.126.67
PPP_SPEED=38400
PPP_TTY=
PPP_TTYNAME=

Und ICH werte in meinen down/up scripten das "CALL_FILE" bzw das
"PPP_IPPARAM" mit aus was ich so angebe:

inittab:
C1:23:respawn:/usr/sbin/pppd call secure >/dev/null 2>&1

pobox:/tmp# grep ipparam /etc/ppp/peers/secure
ipparam secure

Andernfalls wirst du die sessions nicht auseinanderhalten koenen.
ppp0/ppp1 koennen random wechseln. Wen sie es nicht tun ist das
zufall oder gutes ordering im aufbau der sessions.

Ich habe z.b. sowas drin:

if [ -z "${CONNECT_TIME}" ]; then
        if [ "${PPP_IPPARAM}" = "secure" ]; then
                /sbin/iptables -t nat -A POSTROUTING -o ${PPP_IFACE} -j MASQUERADE
        fi
else
        if [ "${PPP_IPPARAM}" = "secure" ]; then
                /sbin/iptables -t nat -D POSTROUTING -o ${PPP_IFACE} -j MASQUERADE
        fi
fi

genauso koennte man einb

if [ "${CALL_FILE}" = "dsl" ]; then
	echo ${CALL_FILE} ${BYTES_SENT} ${BYTES_RECEIVED} >>/var/log/logfile
fi

Da reinbauen.

Jetzt darfst DU mal transferleistung erbringen.

Flo
-- 
Florian Lohoff                  flo at rfc822.org             +49-171-2280134
                        Heisenberg may have been here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lug-owl.de/pipermail/linux/attachments/20050617/198140e5/attachment.sig>


More information about the Linux mailing list