這篇文章是要修改讓 La Fonera 跑 bridge mode,這樣在 La Fonera 後面的電腦,取得的 IP 將會是由第一個 AP 所配發。
至於公開頻道 FON_AP,則是一樣保持 192.168.182.x。
step 1:
登入 La Fonera SSH。(若尚未開啟 SSH port,請參考相關文章)
step 2:
儲存下列的文字至 /etc/init.d/N15bridge
請依照自己的情況與需求,修改 # Set IP for the bridge 部份的設定。
#!/bin/ash
echo "Setting up LAN bridge"
# Kill DHCP server+ client
/usr/bin/killall dnsmasq
/usr/bin/killall -9 udhcpc
# create bridge interface
/usr/sbin/brctl addbr br0
/usr/sbin/brctl stp br0 off
/usr/sbin/brctl setfd br0 0
# shutdown/remove IPs from the old interfaces
/sbin/ifconfig eth0:1 down
/sbin/ifconfig eth0 0.0.0.0
/sbin/ifconfig ath1 0.0.0.0
# bring up the bridge interface
/sbin/ifconfig br0 up
# add the old interfaces to the bridge
/usr/sbin/brctl addif br0 ath1
/usr/sbin/brctl addif br0 eth0
# Set IP for the bridge
/sbin/udhcpc -i br0 -R # get new IP via dhcp
#/sbin/ifconfig br0 192.168.0.4 # remove the leading # to specify a static IP
#/sbin/route add default gw 192.168.0.254 # remove the leading # to specify the default gateway
# set firewall rules
iptables -I INPUT -i br0 -j ACCEPT
iptables -I OUTPUT -o br0 -j ACCEPT
# add bridge to hostapd.conf and restart hostapd (allows to use WPA)
echo bridge=br0 >> /tmp/hostapd.conf
/usr/bin/killall killall hostapd
/usr/sbin/hostapd -B /tmp/hostapd.conf
# restarting dnsmasq but without dhcp
dnsmasq
step 3:
# chmod +x /etc/init.d/N15bridge
# vi /sbin/ifup
修改 wan_ifname=${wan_ifname:-eth0} --> wan_ifname=${wan_ifname:-br0}
# reboot
refer to: Eric Tsai: FON as bridge (讓FON跑橋接模式)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment