終於搞定Gargoyle v1.3.4 on Fonera+, 以下文章完成於實做成功之後, 但還不是很完美, 只能算是Work-around
稍微把ppp-mod-pppoe 和rp-pppoe-client 的行為差異搞懂了, 不過以下只是小弟瞎猜的, ppp-mod-pppoe 會把綁定網路埠的IP 移除, 若該網路埠屬於橋接器之一, 則從橋接器中移除, 而rp-pppoe-client 只會把新的IP 指定給ppp0, 以下是執行 "ifup wan" 和 "logread | grep ppp" 的結果:
語法:
Aug 22 04:00:29 OpenWrt daemon.info pppd[1560]: Plugin rp-pppoe.so loaded.
Aug 22 04:00:29 OpenWrt daemon.notice pppd[1560]: pppd 2.4.4 started by root, uid 0
Aug 22 04:00:29 OpenWrt daemon.info pppd[1560]: PPP session is 10069
Aug 22 04:00:29 OpenWrt daemon.info pppd[1560]: Renamed ppp0 to pppoe-wan
Aug 22 04:00:29 OpenWrt daemon.info pppd[1560]: Using interface pppoe-wan
Aug 22 04:00:29 OpenWrt daemon.notice pppd[1560]: Connect: pppoe-wan <--> br-lan
Aug 22 04:00:30 OpenWrt daemon.notice pppd[1560]: PAP authentication succeeded
以下是執行 "/etc/init.d/pppoe-client start" 和 "logread | grep ppp" 的結果:
語法:
Aug 22 04:03:56 OpenWrt daemon.notice pppd[1662]: pppd 2.4.4 started by root, uid 0
Aug 22 04:03:56 OpenWrt daemon.info pppd[1662]: Using interface ppp0
Aug 22 04:03:16 OpenWrt daemon.notice pppd[1627]: Connect: ppp0 <--> /dev/pts/0
Aug 22 04:03:56 OpenWrt daemon.debug pppoe[1667]: PADS: Service-Name: ''
Aug 22 04:03:56 OpenWrt daemon.info pppoe[1667]: PPP session is 6482 (0x1952)
Aug 22 04:03:57 OpenWrt daemon.warn pppd[1662]: Warning - secret file /etc/ppp/pap-secrets has world and/or group access
Aug 22 04:03:57 OpenWrt daemon.warn pppd[1662]: Warning - secret file /etc/ppp/pap-secrets has world and/or group access
Aug 22 04:03:58 OpenWrt daemon.notice pppd[1662]: PAP authentication succeeded
既然知道ppp-mod-pppoe 會把綁定網路埠的IP 移除, 那就加回來就是了, 以下是Fonera+ (FON2201) 的 /etc/config/network:
語法:
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'
config 'interface' 'lan'
option 'type' 'bridge'
option 'ifname' 'eth0.1 eth0.2'
option 'proto' 'static'
option 'netmask' '255.255.255.0'
option 'ipaddr' '192.168.1.254'
config 'interface' 'wan'
option 'ifname' 'br-lan'
option 'proto' 'pppoe'
option 'username' '[email protected]'
option 'password' 'PASSWORD'
option 'keepalive' '3'
option 'ppp_redial' 'persist'
option 'persist'
先於重啟之後執行 "route"
語法:
root@OpenWrt:/# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 br-lan
可見pppd 並未執行, 於是執行 "ifup wan ; route"
語法:
root@OpenWrt:/# ifup wan ; route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
xxx.xx.xx.xxx * 255.255.255.255 UH 0 0 0 pppoe-wan
default * 0.0.0.0 U 0 0 0 pppoe-wan
pppd 終於成功, 但br-lan 卻不見了, 於是再執行 "ifconfig br-lan 192.168.1.254 netmask 255.255.255.0 ; route"
語法:
root@OpenWrt:/# ifconfig br-lan 192.168.1.254 netmask 255.255.255.0 ; route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
xxx.xx.xx.xxx * 255.255.255.255 UH 0 0 0 pppoe-wan
192.168.1.0 * 255.255.255.0 U 0 0 0 br-lan
default * 0.0.0.0 U 0 0 0 pppoe-wan
最後檢查橋接器是否正確, 以免功虧一簣:
語法:
root@OpenWrt:/# brctl show
bridge name bridge id STP enabled interfaces
br-lan 8000.001884aabbcc no ath0
eth0.1
eth0.2
既然看起來都沒問題了, 剩下的就是找個地方存放Startup Script, 例如 /etc/init.d/custom-user-startup:
語法:
#!/bin/sh /etc/rc.common
START=98
start() {
ifup wan
ifconfig br-lan 192.168.1.254 netmask 255.255.255.0
}
輸入完畢請執行:
語法:
chmod +x /etc/init.d/custom-user-startup
/etc/init.d/custom-user-startup enable
/etc/init.d/custom-user-startup start
以上指令會產生 /etc/rc.d/S98custom-user-startup
La Fonera (FON2100 & FON2200) 應該只需把以上 "eth0.1 eth0.2" 改成 "eth0" 即可套用
此外pppd 指令應該看起來像是:
語法:
/usr/sbin/pppd plugin rp-pppoe.so mtu 1492 mru 1492 nic-br-lan persist usepeerdns defaultroute replacedefaultroute user [email protected] password PASSWORD unit 0 linkname wan ipparam wan
OpenWrt / pppoe with kamikaze
OpenWrt / lan and wan on one ethernet port with vlan
pppd(8): Point-to-Point Protocol Daemon - Linux man page
書籤