Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
zh:docs:guide-user:network:wifi:mesh:80211s [2020/12/30 08:54] – translate installation dependencies and basic configuration shorilezh:docs:guide-user:network:wifi:mesh:80211s [2023/04/06 02:12] – 修复wireless中ifname配置项 shorile
Line 1: Line 1:
-FIXME **This page is not fully translated, yetPlease help completing the translation.**\\ //(remove this paragraph once the translation is finished)//+====== 基于802.11的无线mesh网状网络 ======
  
-====== 802.11s based wireless mesh network ====== +[[wp>IEEE 802.11s|802.11s]] 是一个无需建立基础设施就可以连接无线设备的开源标准. 它在 [[wp>Data_link_layer|Layer 2]] 上运行,并确保所有节点可以在桥接二层网络上看到彼此(就像他们都插入到交换机上一样). 任何 [[wp>Network_layer|Layer 3]] 基础设施都可以在此之上工作. IP router 和 DHCP clients 都能很好运行. 可以根据用例实现更复杂的基础设施。(例如 Batman, Bird, OLSR 等),这些增强的包更多地针对城市级别规模的大型基础设施方案,而不是典型的家庭mesh应用。相比之下,基本的 802.11s 网格适用于家庭mesh的应用场景。
- +
-[[wp>IEEE 802.11s|802.11s]] 是一个无需建立基础设施就可以连接无线设备的开源标准. 它在 [[wp>Data_link_layer|Layer 2]] 上运行,并确保所有节点可以在桥接二层网络上看到彼此(就像他们都插入到交换机上一样). 任何 [[wp>Network_layer|Layer 3]] 基础设施都可以在此之上工作. IP router 和 DHCP clients 都能很好运行. 可以根据用例实现更复杂的基础设施。(例如 Batman, Bird, OLSR 等)+
  
 该视频是使用OpenWRT构建简单网状网络的一个很好的入门教程: https://www.youtube.com/watch?v=kMgs2XFClaM 该视频是使用OpenWRT构建简单网状网络的一个很好的入门教程: https://www.youtube.com/watch?v=kMgs2XFClaM
  
-===== Status =====+===== 现状 =====
  
 802.11s 在 OpenWrt 19.07 及更高版本稳定工作, 包括身份验证和加密, 假设有硬件/驱动程序支持 并且已经安装了 ''wpad-mesh-openssl'' (或同等的工具wpad-mesh-wolfssl)。 802.11s 在 OpenWrt 19.07 及更高版本稳定工作, 包括身份验证和加密, 假设有硬件/驱动程序支持 并且已经安装了 ''wpad-mesh-openssl'' (或同等的工具wpad-mesh-wolfssl)。
  
-:!: There appears to be an ARP relay bug (confirmed in v19.07.4) that means meshing only works reliably from the Mesh-Points that are in wireless range of the Mesh Portal (MPP). See: [[https://forum.openwrt.org/t/bug-report-802-11s-mesh-v19-07-4/78524/4]]   +:!: 有一个ARP中继错误 (v19.07.4确认),这意味着处于mesh网格中只有在Mesh Portal (MPP)的无线范围内的Mesh-Points才正常工作参见: [[https://forum.openwrt.org/t/bug-report-802-11s-mesh-v19-07-4/78524/4]]  
-===== Config =====+
  
-如果默认安装了这些,就需要删除:+ 
 +===== 配置 ===== 
 + 
 +如果需要运行加密的mesh网路, 需要安装支持mesh加密的wpad版本. 
 + 
 +在写这篇文档的时候, 需要以下的wpad版本之一: 
 + 
 +  * wpad-mesh-openssl (精简版以节省空间) 
 +  * wpad-openssl (完整大版本) 
 +  * wpad-mesh-wolfssl (精简版以节省空间) 
 +  * wpad-wolfssl (完整大版本) 
 +  * wpad-mesh-mbedtls(精简版本以节省空间) 
 +  * wpad-mbedtls (完整大版本) 
 + 
 +如果默认安装了这些,就需要删除这些加密功能较少的组件:
  
 <code> <code>
 # opkg remove wpad-mini # opkg remove wpad-mini
 # opkg remove wpad-basic # opkg remove wpad-basic
 +# opkg remove wpad-basic-wolfssl
 +# opkg remove wpad-basic-openssl
 +# opkg remove wpad-basic-mbedtls
 </code> </code>
  
  
- +安装依赖项 (改为''wpad-mesh-openssl''),才能提供mesh网络的加密,wolfssl是性能更好适合嵌入式设备轻量化的加密库,openssl是常见的主流加密库:
-安装依赖项 (改为''wpad-mesh-openssl''),才能提供mesh网络的加密:+
  
 +<code>
 +# opkg install wpad-mesh-wolfssl
 +</code>
 +或者
 <code> <code>
 # opkg install wpad-mesh-openssl # opkg install wpad-mesh-openssl
 </code> </code>
 +或者
 +<code>
 +# opkg install wpad-mesh-mbedtls
 +</code>
 +这样安装只是提供mesh网络的加密
 +
 +建议安装wpad-wolfssl
 +<code>
 +# opkg install wpad-wolfssl
 +</code>
 +或者
 +<code>
 +# opkg install wpad-openssl
 +</code>
 +或者
 +<code>
 +# opkg install wpad-mbedtls
 +</code>
 +就可以把加密提供于mesh、ap等所有网络中了
 +
 +**说明:**
 +  - [[https://github.com/openwrt/openwrt/commit/49cc712b44c76e99bfb716c06700817692975e05|从2019年9月开始]], ''wpad-openssl'' 或者 ''wpad-wolfssl'' //**可以**// 进行 802.11s 加密,wpad-mbedtls 后来加入支持.
 +  - ''wpad-basic-*'' 仅支持 **802.11r** 和 **802.11w**。
 +  - ''wpad-mesh-*'' 仅支持 **802.11r/w** and **802.11s**。
 +  - ''wpad-*'' ,例如 ''wpad-wolfssl'' 是 ''wpad''的**完整版** 提供支持 **802.11k/v/r/w** and **802.11s**。
 +  - ''wpad'' 的 **完整版** 意味着没有进行任何修剪以减小其大小。
 +
 +==== 无线网络配置 ====
  
 编辑 ''/etc/config/wireless'' 并确定: 编辑 ''/etc/config/wireless'' 并确定:
-  * ''radio0'' is not disabled+  * ''radio0'' 没有设置为 disabled,或者disabled设置为0
   * ''radio0'' 在每个设备上都配置兼容 (相同的channel等)   * ''radio0'' 在每个设备上都配置兼容 (相同的channel等)
   * 按下面的形式增加 ''iface'' :   * 按下面的形式增加 ''iface'' :
Line 38: Line 83:
         option network 'mesh'         option network 'mesh'
         option device 'radio0'         option device 'radio0'
 +        option disabled '0'
 +        option network 'lan'
 +        option ifname 'mesh0'
         option mode 'mesh'         option mode 'mesh'
         option mesh_id 'your-mesh-name' # 可以任意字符串, 所有同一个mesh_id的节点连接成一个网格(如果有密码还要加上密码)         option mesh_id 'your-mesh-name' # 可以任意字符串, 所有同一个mesh_id的节点连接成一个网格(如果有密码还要加上密码)
-        option encryption 'psk2/aes'or 'none'+        option encryption 'psk2/aes'或 'sae' ,或不想要加密的话设置为 'none'
         option key 'your-secret-password'         option key 'your-secret-password'
 </code> </code>
  
-**注意:** 客户端设备的访问是通过桥接‘ap’和‘mesh’接口来实现的。+**注意:** 客户端设备的访问是通过桥接‘ap’和‘mesh’接口来实现的,这一点很重要,选项option network 'lan' 的作用是把 'mesh' 接口桥接到了 'lan'。 
 +您要加入mesh网络的每个设备都必须以相同的方式进行配置,即相同的mesh_id,相同的通道channel,相同的密钥。 
 +这种无线wireless配置可能足以满足组建两三个较近的mesh节点的“mesh”网络。 但是,由大量mesh网状节点组成的有机、自主自我管理的mesh网络需要额外的配置
  
-For a complete list of mesh parameters you can inspect the values of the following variables in [[https://github.com/openwrt/openwrt/blob/master/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh|mac80211.sh Source]]:+此配置应该足以启动mesh网络,因此您现在可以重新初始化wifi并查看它是否有效: 
 + 
 +重载网络 
 +<code> 
 +# /etc/init.d/network reload 
 +</code> 
 +查看它是否有效 
 +<code> 
 +# wifi 
 +# iw dev mesh0 info 
 +</code> 
 +应该可以看到类似于以下内容的输出: 
 +<code> 
 +Interface mesh0 
 + ifindex 10 
 + wdev 0x3 
 + addr 12:34:56:78:9a:bc 
 + type mesh point 
 + wiphy 0 
 + channel 2 (2417 MHz), width: 20 MHz, center1: 2417 MHz 
 + txpower 28.00 dBm 
 + multicast TXQ: 
 + qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets 
 + 0 0 129166 0 0 0 0 9107016 129167 
 +</code> 
 + 
 +如果你想在你的mesh网格上运行一个像OLSR这样的路由协议,就禁用 802.11s的内置路由选项 ''option mesh_fwding '0' ''
 + 
 +对于网格参数的完整列表,您可以检查以下变量的值 [[https://github.com/openwrt/openwrt/blob/master/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh|mac80211.sh Source]]:
   * MP_CONFIG_INT   * MP_CONFIG_INT
   * MP_CONFIG_BOOL   * MP_CONFIG_BOOL
   * MP_CONFIG_STRING   * MP_CONFIG_STRING
  
-Alternatively, you can issue the command+或者也可以用以下命令
 <code> <code>
 # iw dev <devname> get mesh_param  # iw dev <devname> get mesh_param 
 </code> </code>
-to obtain a list of available mesh parametersbut without documentation.+来获取可用mesh网格参数表不过没文档.
  
-Then reinitialize wifi and see if it worked:+然后重启无线网络看它的工作情况:
  
 <code> <code>
Line 65: Line 143:
 </code> </code>
  
-===== Wireless Hardware Support =====+===== 无线硬件支持 =====
  
-:!: Support for 802.11s (type mesh) depends on wireless driverMost up to date open source drivers work.+:!: 支持 802.11s (type mesh) 取决于无线驱动程序大多数最新的开源驱动程序都是可以的.
  
-Use the following to determine if your hardware supports 802.11s mesh.+使用以下方法来确定你的硬件是否支持 802.11s mesh.
 <code>iw list | grep "Supported interface modes" -A 9 <code>iw list | grep "Supported interface modes" -A 9
  
Line 86: Line 164:
  
  
-Example: ath9k in router+例如: ath9k的路由器
 <code>iw list <code>iw list
 ... ...
Line 96: Line 174:
 ...</code> ...</code>
  
-Example: ath9k_htc USB Stick+例如: ath9k_htcUSB外设
 <code>iw list <code>iw list
 ... ...
Line 104: Line 182:
 ...</code> ...</code>
  
-===== Using the command line CLI =====+===== 使用命令行方式 =====
  
-iw is a new nl80211 based CLI configuration utility for wireless devices.[[http://wireless.kernel.org/en/users/Documentation/iw#About_iw|more...]]+iw 是一种新的基于 nl80211 wireless devices命令行实用配置工具.[[http://wireless.kernel.org/en/users/Documentation/iw#About_iw|more...]]
  
-Create a new interface "mesh0"+创建新的 interface "mesh0"
 <code>iw phy phy0 interface add mesh0 type mp mesh_id mymesh</code> <code>iw phy phy0 interface add mesh0 type mp mesh_id mymesh</code>
  
-Confirm that the new interface exists+确认新 interface 存在
 <code>ifconfig -a | grep mesh0 <code>ifconfig -a | grep mesh0
  
      mesh0      Link encap:Ethernet  HWaddr 00:18:39:14:48:B5</code>      mesh0      Link encap:Ethernet  HWaddr 00:18:39:14:48:B5</code>
  
-Bring up your mesh0 interface+打开你的 mesh0 interface
 <code>ifconfig mesh0 up</code> <code>ifconfig mesh0 up</code>
  
-Assign the interface an IP address. ie: 10.0.0.x+为接口配置IP地址。 如: 10.0.0.x
 <code>ifconfig mesh0 10.0.0.1</code> <code>ifconfig mesh0 10.0.0.1</code>
  
-By default, mesh points will use channel 1 and automatically attempt to create peer links with mesh nodes with the same mesh ID and channel.+默认情况下, mesh points 会使用 channel 1 并自动尝试创建具有相同mesh IDchannel的mesh节点的对等连接.
  
-===== Verify =====+===== 验证 =====
  
-Use the iw command to display peer links or a table of reachable nodes in your mesh+使用iw命令显示对等链路或mesh网格中可达节点的表
 <code> <code>
 iw dev $MESH_IFACE station dump iw dev $MESH_IFACE station dump
Line 132: Line 210:
 </code> </code>
  
-Example:+例如:
 <code>iw dev $MESH_IFACE station dump <code>iw dev $MESH_IFACE station dump
     Station 00:15:6d:84:14:10 (on mesh)     Station 00:15:6d:84:14:10 (on mesh)
Line 158: Line 236:
 </code> </code>
  
-===== Block single peer from meshing ===== +===== 封锁处于mesh网格中单个节点 ===== 
-//This may require the iw-full package!// +//需要 iw-full !// 
-Block a peer from meshing using its MAC address+ 
 +通过MAC地址封锁处于mesh网格中的节点
 <code> <code>
 iw dev $MESH_IFACE station set $MAC_TO_BLOCK plink_action block iw dev $MESH_IFACE station set $MAC_TO_BLOCK plink_action block
 </code> </code>
-Verify using section above (iw dev $MESH_IFACE station dump)+验证以上是否生效 (iw dev $MESH_IFACE station dump)
 <code> <code>
  mesh plink: BLOCKED  mesh plink: BLOCKED
 </code> </code>
-Unblock:+解除:
 <code> <code>
 iw dev $MESH_IFACE station set $MAC_TO_UNBLOCK plink_action open iw dev $MESH_IFACE station set $MAC_TO_UNBLOCK plink_action open
 </code> </code>
  
-according to [[https://github.com/freifunk-berlin/firmware/issues/726#issuecomment-569065569|this source]] plink_action is not persisted across reconnects of mesh links. +根据 [[https://github.com/freifunk-berlin/firmware/issues/726#issuecomment-569065569|this source]] plink_action 不会在mesh网格链接的重连中持久化。 
-===== More background =====+===== 更多资料 =====
   * [[http://www.cwnp.com/wp-content/uploads/pdf/802.11s_mesh_networking_v1.0.pdf|good background article]] from CWNP   * [[http://www.cwnp.com/wp-content/uploads/pdf/802.11s_mesh_networking_v1.0.pdf|good background article]] from CWNP
   * [[https://wireless.wiki.kernel.org/en/developers/Documentation/ieee80211/802.11s]]   * [[https://wireless.wiki.kernel.org/en/developers/Documentation/ieee80211/802.11s]]
   * [[http://lists.open80211s.org|Open80211s Mailing List]]   * [[http://lists.open80211s.org|Open80211s Mailing List]]
  • Last modified: 2024/01/23 08:00
  • by shorile