|
蓝森林 http://www.lslnet.com 2006年4月6日 20:18
动态域名ppp.linkup配置问题
家里的机器,adsl上网,动态IP,在http://www.2mydns.com/申请了个二级域名,更新DDNS方法是http://dyn.2mydns.com/dyn.asp?username=bla&password=bla&hostname=bla.2mydns.com&myip=123.321.0.1
写了个脚本ddns.sh
#!/bin/sh
IP=`ifconfig tun0 | grep inet | awk '{print $2}'`;
/usr/local/bin/wget -q "http://dyn.2mydns.com/dyn.asp?username=bla&password=bla&hostname=bla.2mydns.com&myip=$IP" -O /dev/null;
执行后,http://bla.2mydns.com/正确指向家中IP,现在想在每次ppp建立连接后自动更新动态dns记录,于是在/etc/ppp/下建立ppp.linkup文件
adsl:
!bg /home/bla/ddns.sh > /dev/null
但每次ppp连接建立后都会报告错误:
tun0: Warning: /etc/ppp/ppp.linkup: !bg /home/bla/ddns.sh > /dev/null: Invalid command
搞不懂怎么就无效命令了,请指点迷津,谢谢
|
格式问题?
贴一下ppp.conf,ppp.linkup |
# cat /etc/rc.conf
# -- sysinstall generated deltas -- # Sun Jun 11 21:44:31 2006
# Created: Sun Jun 11 21:44:31 2006
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
ifconfig_xl0="inet 192.168.1.2 netmask 255.255.255.0"
ifconfig_xl1="inet 192.168.0.1 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
hostname="www.blabla.com"
gateway_enable="YES"
linux_enable="YES"
sshd_enable="YES"
ppp_enable="YES"
ppp_mode="ddial"
ppp_nat="YES"
ppp_profile="adsl"
firewall_enable="NO"
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
syslogd_enable="YES"
syslogd_flags="-ss"
clear_tmp_enable="YES"
# cat /etc/ppp/ppp.conf
#################################################################
# PPP Sample Configuration File
# Originally written by Toshiharu OHNO
# Simplified 5/14/1999 by [email]wself@cdrom.com[/email]
#
# See /usr/share/examples/ppp/ for some examples
#
# $FreeBSD: src/etc/ppp/ppp.conf,v 1.10 2004/11/19 17:12:56 obrien Exp $
#################################################################
default:
set log Phase Chat LCP IPCP CCP tun command
set ifaddr 192.168.1.1/0 192.168.1.2/0
enable dns
adsl:
set device PPPoE:xl0
set authname [email]bla@163.bla[/email]
set authkey BLABLA
set dial
set login
add default HISADDR
# cat /etc/ppp/ppp.linkup
#########################################################################
#
# Example of ppp.linkup file
#
# This file is checked when ppp establishes a connection.
# ppp searches the labels in this file as follows:
#
# 1) The label that matches the IP number assigned to our side.
#
# 2) The label specified on the command line to ppp.
#
# 3) If no label has been found, use MYADDR if it exists.
#
#
# $FreeBSD: src/share/examples/ppp/ppp.linkup.sample,v 1.2 1999/08/28 00:19:31 peter Exp $
#
#########################################################################
# It is no longer necessary to re-add the default route here as our
# ppp.conf route is `sticky' (see the man page).
# If you're into sound effects when the link comes up, you can run
# ``auplay'' (assuming NAS is installed and configured).
#
adsl:
!bg /home/bla/ddns.sh > /dev/null
# cat ddns.sh
#!/bin/sh
IP=`ifconfig tun0 | grep inet | awk '{print $2}'`;
/usr/local/bin/wget -q "http://dyn.2mydns.com/dyn.asp?username=bla&password=bla&hostname=bla.2mydns.com&myip=$IP" -O /dev/null; |
[quote]原帖由 [i]leix[/i] 于 2006-8-1 11:58 发表
adsl:
!bg /home/bla/ddns.sh > /dev/null [/quote]
前面空一格或tab试试. |
[quote]原帖由 [i]congli[/i] 于 2006-8-1 13:32 发表
前面空一格或tab试试. [/quote]
:shock:
加了个空格,顺利通过,更新DNS成功,太神了点吧?! |
| |