海运的博客

通过OpenWRT连接ROS重新PPPoe拨号

发布时间:May 27, 2013 // 分类:ROS // No Comments

OpenWRT安装PPPoe服务器,当客户端连接或断开时通过ip-down.d/ip-up.d执行ROS命令,ROS需配置使用SSH Key验证
当系统拨号断开时停止PPPoe:

mkdir /etc/ppp/ip-down.d
cat >/etc/ppp/ip-down.d/pppoe-down.sh << EOF
#!/bin/sh
ssh admin@192.168.1.21 "/interface pppoe-client disable pppoe-out1"
EOF
chmod +x /etc/ppp/ip-down.d/pppoe-down.sh 

当连接系统拨号连接时开启PPPoe:

mkdir /etc/ppp/ip-up.d
cat >/etc/ppp/ip-up.d/pppoe-up.sh << EOF
#!/bin/sh
ssh admin@192.168.1.21 "/interface pppoe-client enable pppoe-out1"
EOF
chmod +x /etc/ppp/ip-up.d/pppoe-up.sh 

2015.03.17更新:
ros重新拨号只需enable就行,无需先disable:

ssh admin@192.168.1.21 "/interface pppoe-client enable pppoe-out1"

OpenWRT更新到14.07安装的pppoe不执行ip-down.d或up目录下脚本,需添加相应脚本,PPPD连接时会执行此脚本:

cat >/etc/ppp/ip-up << EOF
#!/bin/sh
[ -d /etc/ppp/ip-up.d ] && {
        for SCRIPT in /etc/ppp/ip-up.d/*
        do
                [ -x "$SCRIPT" ] && "$SCRIPT" "$@"
        done
}
EOF
chmod +x /etc/ppp/ip-up

使用SSH Key验证登录ROS

发布时间:May 26, 2013 // 分类:ROS // No Comments

首先生成SSH key:

ssh-keygen -t dsa

复制SSH Key到ROS:

scp ~/.ssh/id_dsa.pub admin@192.168.1.21:

登录到ROS导入SSH Key:

user ssh-keys import public-key-file=id_dsa.pub user=admin 

然后就可免验证登录ROS了:

ssh admin@192.168.1.21

OpenWRT安装配置PPPoe服务器

发布时间:May 26, 2013 // 分类:OpenWrt // 1 Comment

OpenWRT安装PPPoe:

opkg update
opkg install rp-pppoe-server

配置PPPoe:

cat > pppoe-server-options << EOF
# PPP options for the PPPoE server
# LIC: GPL
require-chap
login
lcp-echo-interval 10
lcp-echo-failure 2
ms-dns 8.8.8.8
EOF

设置PPPoe账号、密码:

cat >/etc/ppp/chap-secrets << EOF
#USERNAME  PROVIDER  PASSWORD  IPADDRESS
www.haiyun.me * www.haiyun.me *
EOF

启动PPPoe服务脚本:

cat >/etc/init.d/pppoe-server << EOF
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=50

start() {
        echo 1 > /proc/sys/net/ipv4/ip_forward
        iptables -t nat -A POSTROUTING -s 10.0.1.0/24 -j MASQUERADE
        /usr/sbin/pppoe-server -k -T 60 -I eth1.1 -N 100 -L 10.0.1.1 -R 10.0.1.2
}

stop() {
        iptables -t nat -D POSTROUTING -s 10.0.1.0/24 -j MASQUERADE
    killall pppoe-server
}
EOF
chmod +x /etc/init.d/pppoe-server

遇到的问题1,客户端连接错误代码619,使用tcpdump监听数据包:

Generic-Error "RP-PPPoE: Child pppd process terminated"

查看pppoe错误日志:

May 26 13:31:07 OpenWrt daemon.notice pppd[4972]: Connect: ppp0 <--> /dev/pts/1
May 26 13:31:07 OpenWrt daemon.notice pppd[4972]: Modem hangup
May 26 13:31:07 OpenWrt daemon.notice pppd[4972]: Connection terminated.

解决方法:启动参数加-k,加载内核pppoe模块启动。
遇到的问题2,客户端连接错误代码691,原因:

用户名或密码填写错误
require-chap账号密码文件确认为chap-secrets

Lnmp编译添加php imap模块

发布时间:May 11, 2013 // 分类:PHP // No Comments

cd php-5.2.17/ext/imap
/usr/local/php/bin/phpize 
./configure --with-php-config=/usr/local/php/bin/php-config --with-kerberos --with-imap-ssl
make
make install

编译时如遇到错误:

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

安装imap库:

yum install libc-client-devel

加载imap到php配置文件:

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
extension=imap.so

此内容被密码保护

发布时间:May 9, 2013 // 分类:Mail // No Comments

请输入密码访问

分类
最新文章
最近回复
  • zzg: http://downloads.openwrt.org.cn/PandoraBox/rali...
  • xiongrui: 看图
  • 傻狍子: filebrowser好像和这功能一样? https://github.com/filebro...
  • 陶国文: 想看看能不能安装
  • 傻狍子: 服务端设置了用户名密码认证的话,在openwrt的openvpn客户端的配置文件当中该如何更改...
  • 王阴阳师: 感谢,一点不啰嗦,还很管用!
  • simon: 刚刚看了我的vps,玛德,居然也有人在一直尝试登录,幸好我的密码是强密码
  • thornbird: 又学会一招,不错
  • 头很黑: 除了发送eth转账 ,还能转账其他的代币吗 比如eos
  • 米扑博客: 总结的很棒