[心得] 讓FON跑Bridge Mode

看板MOD_AP (無線基地台韌體)作者 (dream of you...)時間18年前 (2007/04/03 19:16), 編輯推噓9(901)
留言10則, 6人參與, 最新討論串1/1
http://erictsai.spaces.live.com/blog/cns!5D64586FED470F7B!397.entry 改完後終於不用再多一層NAT,桌機可以跟每台NB互傳檔案了~ 1. 用SSH client登入 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 # FON由DHCP取得IP,若要手動指定IP則在最前面加上# #/sbin/ifconfig br0 192.168.0.103 # 若要手動指定FON的IP,移除這兩行最前面的# #/sbin/route add default gw 192.168.0.254 # 手動設IP時指定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 hostapd /usr/sbin/hostapd -B /tmp/hostapd.conf # restarting dnsmasq but without dhcp dnsmasq 3. chmod +x /etc/init.d/N15bridge 4. 將 /sbin/ifup 中的 wan_ifname=${wan_ifname:-eth0} 改為 wan_ifname=${wan_ifname:-br0} 5. 登入www.fon.com,更新分享頻寬 (沒更新的話好像限制會失效) 6. reboot 若將來的更新有更新到/sbin/ifup這個檔案,則需再做一次步驟4並重新啟動。 -- 我的電腦心得筆記:http://erictsai.spaces.live.com -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.96.85 ※ 編輯: EricTsai 來自: 140.116.96.85 (04/03 19:39)

04/03 21:13, , 1F
FON_AP認證完成後 不就可以連線到區域網路中的電腦 ??
04/03 21:13, 1F

04/03 21:38, , 2F
不會。介面不對,會被iptables擋掉
04/03 21:38, 2F

04/03 21:59, , 3F
reboot之後就不能上網了XD
04/03 21:59, 3F

04/04 00:39, , 4F
下週有空我要來改這個,還蠻重要的
04/04 00:39, 4F

04/04 19:27, , 5F
嗯~我搞錯了 ath0才是FON_AP用的 ath1是Private用的
04/04 19:27, 5F

04/05 12:20, , 6F
這是逼人改成DD-WRT|_??
04/05 12:20, 6F

04/05 12:34, , 7F
回錯文了....
04/05 12:34, 7F

04/11 21:45, , 8F
wan_ifname=${wan_ifname:-br0}" <-- 後面沒有 " 才對
04/11 21:45, 8F

04/11 21:46, , 9F
wan_ifname=${wan_ifname:-br0} 正確的
04/11 21:46, 9F

04/12 00:29, , 10F
不好意思,從我Blog複製過來改成中文的時候忘記刪掉了
04/12 00:29, 10F
※ 編輯: EricTsai 來自: 140.116.96.85 (10/31 00:53)
文章代碼(AID): #164ZUPm5 (MOD_AP)
文章代碼(AID): #164ZUPm5 (MOD_AP)