使用openwrt(LEDE)桥接两个无线接口

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用openwrt(LEDE)桥接两个无线接口相关的知识,希望对你有一定的参考价值。

AP:AP121U(ALFA)外置Wifi卡:AR9271(ALFA)

我正在尝试设置wifi扩展。但是我现在卡住了:管理将内部Wifi放入Master(wlan0),将外部放入Client-mode(wlan1),连接到我想重复的网络。

setup:

wlan0 (router): Mastermode with dhcp server 192.168.44.1

wlan1 (external card): dhcpclientmode 192.168.0.19

两者都在工作和联系。路由器有互联网连接。 kmod-ath0k_btc模块已安装并正常工作。

我通过SerialUSB + MasterWIFI(internal-ap)连接到路由器。

root@LEDE:/# ifconfig
eth1      Link encap:Ethernet  HWaddr 00:C0:CA:6F:01:14  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:4 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:88 errors:0 dropped:0 overruns:0 frame:0
          TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:7415 (7.2 KiB)  TX bytes:7415 (7.2 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:C0:CA:6F:01:16  
          inet addr:192.168.44.1  Bcast:192.168.44.255  Mask:255.255.255.0
          inet6 addr: fe80::2c0:caff:fe6f:116/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8185 errors:0 dropped:0 overruns:0 frame:0
          TX packets:635 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:664774 (649.1 KiB)  TX bytes:206006 (201.1 KiB)

wlan1     Link encap:Ethernet  HWaddr 00:C0:CA:72:67:A2  
          inet addr:192.168.0.19  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::2c0:caff:fe72:67a2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1384 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7004 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:154433 (150.8 KiB)  TX bytes:686873 (670.7 KiB)

root@LEDE:/# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=57 time=16.095 ms
64 bytes from 8.8.8.8: seq=1 ttl=57 time=14.629 ms
64 bytes from 8.8.8.8: seq=2 ttl=57 time=15.680 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 14.629/15.468/16.095 ms


round-trip min/avg/max = 14.629/15.468/16.095 ms

root@LEDE:/# cat /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 globals 'globals'
        option ula_prefix 'fdb8:507a:4e00::/48'

config interface 'lan'
        option ifname 'eth0'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option auto '0'

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'

config interface 'wan6'
        option ifname 'eth1'
        option proto 'dhcpv6'

config interface 'master'
        option _orig_ifname 'wlan0'
        option _orig_bridge 'false'
        option proto 'static'
        option ipaddr '192.168.44.1'
        option netmask '255.255.255.0'

config interface 'client'
        option proto 'dhcp'

现在我想要的是TCP从外部适配器路由到我,客户端连接到Master-AP。

在GUI中,在物理设置下,在客户端和主服务器上,我检查了“在指定接口上创建桥接”并检查了客户端和主服务器。不幸的是,我把我锁在了路由器之外,最后我重新刷新了LEDE。

Bridge interfaces x creates a bridge over specified interface(s)
Interface
   Ethernet Adapter: "eth0" (lan)
   Ethernet Adapter: "eth1" (wan, wan6)
x Wireless Network: Master "b0x" (master)  
x Wireless Network: Client "manos222" (client)
   Custom Interface: 

现在我想要的是TCP从外部适配器路由到我,客户端连接到Master-AP。

在GUI中,在物理设置下,在客户端和主服务器上,我检查了“在指定接口上创建桥接”并检查了客户端和主服务器。不幸的是,我把我锁在了路由器之外,最后我重新刷新了LEDE。

Bridge interfaces x creates a bridge over specified interface(s)
Interface
   Ethernet Adapter: "eth0" (lan)
   Ethernet Adapter: "eth1" (wan, wan6)
x Wireless Network: Master "b0x" (master)  
x Wireless Network: Client "manos222" (client)
   Custom Interface: 

我觉得我很亲密。如果有人能指出我正确的方向,将不胜感激。我觉得我很亲密。如果有人能指出我正确的方向,将不胜感激。

答案

几个小时后无数......

echo 1 > /proc/sys/net/ipv4/ip_forward

#Reset iptables
iptables -F
iptables -X

iptables -A FORWARD -o wlan1 -i br-lan -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE

做了伎俩

以上是关于使用openwrt(LEDE)桥接两个无线接口的主要内容,如果未能解决你的问题,请参考以下文章

请教一些问题,关于openwrt连接AP的?

openwrt桥接后ping

OpenWrt分支LEDE嵌入式无线路由系统定制-2.自定义固件

openwrt无线桥接无线未开启

有人在openwrt路由器上运行ocserv成功的么

openwrt 接口路由是怎么添加的