FON as bridge (讓FON跑橋接模式)

  1. Login with a SSH client.
  2. Save the following (modified from this script) as /etc/init.d/N15bridge. Modify the “# Set IP for the bridge" section to meet your needs.
    #!/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 of the bridge for FON remote admin
    /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 hostapd
    /usr/sbin/hostapd -B /tmp/hostapd.conf

    # restarting dnsmasq but without dhcp
    dnsmasq

  3. chmod +x /etc/init.d/N15bridge
  4. vi /sbin/ifup, replace “wan_ifname=${wan_ifname:-eth0}" with “wan_ifname=${wan_ifname:-br0}", save the file.
  5. Go to www.fon.com, log in and update shared bandwidth.
  6. reboot

If /sbin/ifup has been updated in future updates, you must modify it again after the update and reboot.

廣告
本篇發表於 電腦和網際網路。將永久鏈結加入書籤。

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s