[心得] 讓FON跑Bridge Mode
看板MOD_AP (無線基地台韌體)作者EricTsai (dream of you...)時間18年前 (2007/04/03 19:16)推噓9(9推 0噓 1→)留言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
04/03 21:13, 1F
推
04/03 21:38, , 2F
04/03 21:38, 2F
推
04/03 21:59, , 3F
04/03 21:59, 3F
推
04/04 00:39, , 4F
04/04 00:39, 4F
推
04/04 19:27, , 5F
04/04 19:27, 5F
推
04/05 12:20, , 6F
04/05 12:20, 6F
推
04/05 12:34, , 7F
04/05 12:34, 7F
推
04/11 21:45, , 8F
04/11 21:45, 8F
→
04/11 21:46, , 9F
04/11 21:46, 9F
推
04/12 00:29, , 10F
04/12 00:29, 10F
※ 編輯: EricTsai 來自: 140.116.96.85 (10/31 00:53)
MOD_AP 近期熱門文章
PTT數位生活區 即時熱門文章