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

时间:2018-03-01 19:58:31

标签: networking wifi embedded-linux openwrt

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

我正在尝试设置wifi扩展程序。 但是现在我被困住了: 管理将内部Wifi放入Master(wlan0),将外部Wifi放入客户端模式(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: 

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

1 个答案:

答案 0 :(得分:0)

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

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

做了这个伎俩