Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
zh:docs:guide-user:network:switch_router_gateway_and_nat [2021/06/30 07:37] – [Router/gateway and double NAT problem with IPv4 or mixed IPv4/IPv6] biajizh:docs:guide-user:network:switch_router_gateway_and_nat [2021/07/01 07:44] – [OpenWrt as wireless access point (wireless-to-wired switch)] biaji
Line 29: Line 29:
 IPv4的问题在于:当你在现存的路由和ISP(互联网服务提供商)之间加上一个IPv4路由的时候,你就会遇到这个名为 **双NAT** 的问题——新加的路由和现存的ISP提供的路由都做了NAT,最终导致客户端的数据在抵达因特网之前被“NAT”了两次。 IPv4的问题在于:当你在现存的路由和ISP(互联网服务提供商)之间加上一个IPv4路由的时候,你就会遇到这个名为 **双NAT** 的问题——新加的路由和现存的ISP提供的路由都做了NAT,最终导致客户端的数据在抵达因特网之前被“NAT”了两次。
  
-This double NAT scenario won't cause problems for basic tasks like browsing the internet, but it can cause problems when you are trying to host servers at home that you want to be reachable from the internet, or when doing peer-to-peer online gaming (which often uses the UDP protocol and does some funny firewall stuff called "UDP hole-punching").+在一般情况下,比如浏览互联网的时候,这种双NAT的场景不会造成什么问题。但当你想在家里建一个服务器,以供互联网访问的时候,亦或玩一些端到端连接的网络游戏的时候(这些游戏经常用UDP协议并会对防火墙做一些类似“UDP打洞”的神奇操作),问题就出现了。
  
-To deal with this double NAT problem and use IPv4 as flawlessly as possible, you need to choose how OpenWrt gets connected on its upstream side from several options. Note that in all these examples, the OpenWrt device is assumed to be on the "inside" of the network, i.e. clients <-> OpenWrt device <-> ISP device <-> Internet. Since the OpenWrt device is our main concern, we'll refer to //upstream// and //downstream// connections relative to it+为了解决双NAT问题,以尽量完美的使用IPv4,您需要从OpenWrt如何连接上游的几个选项中选择一个。请注意,在这些示例中,OpenWrt设备被认为是在网络“内部”的,诸如 客户端 <-> OpenWrt设备 <-> ISP设备 <-> 因特网。因为我们主要关注OpenWrt设备,我们将以它来定义相对的 //上游// 和 //下游// : 
-  * **Upstream**: the connection from the OpenWrt device to your network infrastructure +  * **上游**: OpenWrt设备到您的网络基础设施 
-  * **Downstream**: your home client devices connecting to your OpenWrt device+  * **下游**: 您家里连接到OpenWrt设备的客户端设备
  
 There is a range of options to connect the upstream side of OpenWrt to your existing home network. Each option tries to work around the double NAT problem with different technical tricks or configuration: There is a range of options to connect the upstream side of OpenWrt to your existing home network. Each option tries to work around the double NAT problem with different technical tricks or configuration:
Line 47: Line 47:
 | single | [[#device_as_a_gateway_with_a_true_modem_between_it_and_the_internet|OpenWrt as gateway using either OpenWrt-device-built-in or external modem]] | clients <-> OpenWrt as gateway with NAT <-> built-in/external modem (no NAT) <-> Internet | | single | [[#device_as_a_gateway_with_a_true_modem_between_it_and_the_internet|OpenWrt as gateway using either OpenWrt-device-built-in or external modem]] | clients <-> OpenWrt as gateway with NAT <-> built-in/external modem (no NAT) <-> Internet |
  
-====== Switches and client APs ====== +====== 作为交换机或客户端AP ====== 
-| single | Three usage Variants: \\ [[#openwrt_as_wireless_repeater_wifi_wifi_switch|OpenWrt as wireless repeater (Wi-Fi <-> Wi-Fi switch)]] \\ [[#openwrt_as_wireless_access_point_wifi_wired_switch|OpenWrt as wireless access point (Wi-Fi <-> wired switch)]] \\ [[#openwrt_as_a_wire_wire_switch|OpenWrt as wire (wire <-> wire switch)]] | clients <-> OpenWrt as switch (no NAT) <-> ISP router (with NAT) <-> Internet |+| single | 三种用法: \\ [[#openwrt_as_wireless_repeater_wifi_wifi_switch|OpenWrt作为无线中继(Wi-Fi <-> Wi-Fi交换机)]] \\ [[#openwrt_as_wireless_access_point_wifi_wired_switch|OpenWrt作为无线接入点(Wi-Fi <-> 有线交换机)]] \\ [[#openwrt_as_a_wire_wire_switch|OpenWrt作为有线交换机(有线 <-> 有线交换机)]] | 客户端 <-> OpenWrt交换机(NAT) <-> ISP路由器(NAT) <-> 因特网 |
   
 Note that for all of these upstream connection variants, the following applies: Note that for all of these upstream connection variants, the following applies:
 +
   * all variants can handle both wireless and wired clients on the downstream side (i.e. client devices connected to your LAN)   * all variants can handle both wireless and wired clients on the downstream side (i.e. client devices connected to your LAN)
   * all variants can host software services for both downstream and upstream sides (like NAS shares)   * all variants can host software services for both downstream and upstream sides (like NAS shares)
Line 149: Line 150:
 Note: In case you are interested in creating a so called "wireless mesh" instead of a wireless repeater, you will have to refer to other projects, e.g. [[https://libremesh.org/]] or [[https://open-mesh.org/]] at this time. Note: In case you are interested in creating a so called "wireless mesh" instead of a wireless repeater, you will have to refer to other projects, e.g. [[https://libremesh.org/]] or [[https://open-mesh.org/]] at this time.
  
-===== OpenWrt as wireless access point (wireless-to-wired switch)===== +===== OpenWrt作为无线接入点(无线到有线交换机)===== 
-Follow: [[docs:guide-user:network:wifi:dumbap|Wi-Fi access point]]+遵循: [[docs:guide-user:network:wifi:dumbap|Wi-Fi接入点]]
  
-As a wireless access point, OpenWrt connects to the existing network by wire. OpenWrt then acts as a networking device that allows your Wi-Fi devices to connect to the wired network over OpenWrt.  +作为一个无线接入点,OpenWrt将以有线连接至现存网络。供您的无线设备经由OpenWrt连接至有线网络所用。 
-  * the wired network provides Internet access+  * 有线网络提供因特网访问
   * OpenWrts upstream side (the other wired network it will connect to) will be a wired connection to the existing router. So OpenWrt acts as a client of this existing other network.   * OpenWrts upstream side (the other wired network it will connect to) will be a wired connection to the existing router. So OpenWrt acts as a client of this existing other network.
   * OpenWrts downstream side (the Wi-Fi network that OpenWrt will provide) will be an access point for your wireless clients   * OpenWrts downstream side (the Wi-Fi network that OpenWrt will provide) will be an access point for your wireless clients
  • Last modified: 2022/03/17 10:11
  • by biaji