让adsl连接建立后自动添加网关,并自动把ip同步到3322.org
笔者使用rp-pppoe软件拨号上网,但每次重启之后都要手动添加网关,手动同步动态ip到3322,尤为不爽。本文先容如何在pppoe连接建立之后自动添加网关。pppoe连接建立后,系统自动调用/etc/ppp/ip-up脚本。其参数如下面文件所示,第4个参数是系统获得的动态ip。#!/bin/bash## Script which handles the routing issues as necessary for pppd# Only the link to Newman requires this handling.## When the ppp link comes up, this script is called with the following# parameters# $1 the inte***ce name used by pppd (e.g. ppp3)# $2 the tty device name# $3 the tty device speed# $4 the local IP address for the inte***ce# $5 the remote IP address# $6 the parameter specified by the 'ipparam' option to pppd#PATH=/sbin:/usr/sbin:/bin:/usr/binexport PATHroute add default gw $4#下面这一行是使用3322.org的动态域名,如没有使用,可以不加。/usr/local/bin/ez-ipupdate -c /usr/local/ezip/qdns.conf把以上内容存为/etc/ppp/ip-up.local并chmod 755 /etc/ppp/ip-up.local,使之有执行权限。由于ip-up会自动找ip-up.local执行,所以不用修改ip-up文件。最后执行:service network restartip addr(多看几次ip,假如ppp0获取了ip地址,则用route查看网关是否已经自动添加)route祝您成功!
页:
[1]