ppp_server

来自「Affix - Bluetooth Protocol Stack for Lin」· 代码 · 共 82 行

TXT
82
字号
#!/bin/sh## $Id: ppp_server,v 1.3 2002/10/09 15:26:12 kds Exp $## Script to start a PPP server on a serial connection. The script is called# with the serial device file open on the standard input and output.# The following options can be specified for this script:#  notty      : the serial device file is not a tty (i.e. a socket)#  masquerade : setup masquerading#  proxyarp   : setup proxyarplogerror(){	echo $1 >&2	logger -p daemon.err -t $0 "$@"}usage(){	echo "Usage: $0 [line <id>] [connid <id>] [notty] [proxyarp|masquerade]" >&2}CONNID=0DEV=""LOCALIP=192.168.0.1REMOTEIP=192.168.0.2# Get the DNS server's from resolv.conf. They will be offered to the PPP client.if [ -f /etc/resolv.conf ] ; then	DNS=`sed -n 's/^nameserver \+\([0-9.]\+\)$/ms-dns \1/p' < /etc/resolv.conf | head -2`fiwhile [ $# != 0 ] ; do	case "$1" in	# Determine if we must masquerade or setup proxyarp	proxyarp)		PROXYARP=proxyarp		;;	masquerade)		if [ -n "$PROXYARP" ] ; then			logerror "Only one of proxyarp and masquerade can be specified."			exit -1		fi		# Be sure that  masquerading is supported in your system!!!		IPPARAM="ipparam MASQUERADE"		;;	notty)		NOTTY=notty		;;	connid)		CONNID=`echo $[$2] 2> /dev/null`		if [ "$CONNID" != "$2" ] ; then			logerror "Invalid connection id"			usage			exit -1		fi		REMOTEIP=192.168.0.$[$CONNID + 2]		shift		;;	line)		LINE=`echo $[$2] 2> /dev/null`		if [ "$LINE" != "$2" ] ; then			logerror "Invalid line id"			usage			exit -1		fi		DEV="/dev/bty$2"		shift		;;	?*)		usage		exit -1		;;	esac	shiftdonePPP_OPTS="passive persist $DNS $IPPARAM $PROXYARP $NOTTY $LOCALIP:$REMOTEIP"exec /usr/sbin/pppd $DEV $PPP_OPTS

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?