作者EricTsai (dream of you...)
看板FON
標題[心得] 讓FON跑Bridge Mode
時間Tue Apr 3 19:16:38 2007
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)
推 jyhfang:FON_AP認證完成後 不就可以連線到區域網路中的電腦 ?? 04/03 21:13
推 EricTsai:不會。介面不對,會被iptables擋掉 04/03 21:38
推 chadjye:reboot之後就不能上網了XD 04/03 21:59
推 JLurker:下週有空我要來改這個,還蠻重要的 04/04 00:39
推 jyhfang:嗯~我搞錯了 ath0才是FON_AP用的 ath1是Private用的 04/04 19:27
推 richjf:這是逼人改成DD-WRT|_?? 04/05 12:20
推 richjf:回錯文了.... 04/05 12:34
推 OTZ:wan_ifname=${wan_ifname:-br0}" <-- 後面沒有 " 才對 04/11 21:45
→ OTZ:wan_ifname=${wan_ifname:-br0} 正確的 04/11 21:46
推 EricTsai:不好意思,從我Blog複製過來改成中文的時候忘記刪掉了 04/12 00:29
※ 編輯: EricTsai 來自: 140.116.96.85 (10/31 00:53)