openwrt 中继2

http://wiki.openwrt.org/doc/recipes/relayclient


Due I'm seeing a lot of confusion to make a repeater with OpenWRT, I will put the 2 modes available, with its configs.
I hope its easy to understand.
Of course, first install the latest Trunk version of OpenWrt:
http://downloads.openwrt.org/snapshots/trunk/
Working in Atheros hardware and Attitude Adjustment. I don't know if it works on other hardware or OpenWrt versions.

MODE 1: BRIDGED REPEATER

Both wireless networks will be the same network, DHCP addresses wil be given by the main router, all computers will see each other.

First connect the router to internet, by connecting an ethernet cable between the openwrt's router WAN port and the main router.
Install Relayd

opkg update 
opkg install relayd
/etc/init.d/relayd enable

.
.
/etc/config/wireless

config wifi-device 'radio0'
        #blahblah (default settings)
    option channel '1'         #Match with the main wireless network channel
    option disabled '0'

config wifi-iface
    option ssid 'MainWirelessNetwork'
    option encryption 'psk'        # Set wep, psk or psk2 for WEP, WPA or WPA2
    option device 'radio0'
    option mode 'sta'
    option network 'wwan'
    option key 'MainRouterWirelessPassword'

config wifi-iface
    option device 'radio0'
    option mode 'ap'
    option ssid 'RepeaterWirelessNetwork'
    option encryption 'psk'
    option key 'RepeaterWirelessPassword'
    option network 'lan'

.
.
/etc/config/network

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config interface 'lan'
    option ifname 'eth0'
    option type 'bridge'
    option proto 'static'
    option ipaddr '192.168.1.254' #Set this to match you main router network 192.168.x.254
    option netmask '255.255.255.0'
    option gateway '192.168.1.1'   # Your main router's IP
    option dns     '8.8.8.8'

config interface 'wwan'
    option proto 'static'
    option 
    option 

config 'interface' 'stabridge' 
    option 'proto' 'relay' 
    option 'network' 'lan wwan' 
    option ipaddr '10.0.0.240'

.
.
/etc/config/dhcp

config dhcp lan
    option interface    lan
    option start     100
    option limit    150
    option leasetime    12h
    option ignore    1

config dhcp wan
    option interface    wan
    option ignore    1

.
.
As we want to make all the same network, we can disable the firewall:

/etc/init.d/firewall stop
/etc/init.d/firewall disable

.
.
.
MODE 2: REPEATER, DIFFERENT NETWORK

Repeater's clients will be able to see Main Network's devices, but not vice versa.
Addresses in the Repeater network are managed by the repeater.

Nothing has to be downloaded, the stock openwrt is enought. This is the easiest and simplest way of making a repeater

/etc/config/wireless

config wifi-device 'radio0'
    #blahblah (default settings)
    option disabled '0'
    option channel '1'       #Match with the main wireless network channel

config wifi-iface
    option ssid 'MainWirelessNetwork'
    option encryption 'psk'        # Set wep, psk or psk2 for WEP, WPA or WPA2
    option device 'radio0'
    option mode 'sta'
    option network 'wwan'
    option key 'MainRouterWirelessPassword'

config wifi-iface
    option device 'radio0'
    option mode 'ap'
    option ssid 'RepeaterWirelessNetwork'
    option encryption 'psk'
    option key 'RepeaterWirelessPassword'
    option network 'lan'

.
.
/etc/config/network

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config interface 'lan'
    option ifname 'eth0'
    option type 'bridge'
    option proto 'static'
    option ipaddr '192.168.10.1'    #set to different range of your main router's network""
    option netmask '255.255.255.0'

config interface 'wwan'
    option proto 'dhcp'

.
.
/etc/config/dhcp

config dhcp lan
    option interface    lan
    option start     100
    option limit    150
    option leasetime    12h
    option ignore    0

config dhcp wan
    option interface    wan
    option ignore    1

.
.
/etc/config/firewall

config defaults
    option syn_flood '1'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'REJECT'

config zone
    option name 'lan'
    option network 'lan'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'REJECT'

config zone
    option name 'wan'
    option input 'REJECT'
    option output 'ACCEPT'
    option forward 'REJECT'
    option masq '1'
    option mtu_fix '1'
    option network 'wan wwan'

config forwarding
    option src 'lan'
    option dest 'wan'

Once internet is running, its easy to install LuCi to get the nice WWW interface:

opkg update
opkg install luci

AND, IF YOU INSTALLED RELAYD
opkg install luci-proto-relay
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值