OpenWrt的多WAN和静态路由设置

配置第二个WAN

增加新VLAN

Network->Switch 增加新的VLAN, 默认安装已经存在两个VLAN ID 1和2,新增的VLAND ID为3。
对应这行新记录,将CPU设为tagged,选择一个LAN口为untagged,同时将这个LAN对应原来的untagged设为off,这样这个LAN口就可以作为新的WAN口使用,新建的这个在网络配置中为eth0.3

增加新Interface

Network->Interface,添加一个新接口,命名为wanb, 选择刚才创建的eth0.3,下一步,高级设置中,将访问器设为和WAN/WAN6一组。

增加静态路由

增加路由需要以下信息

  • Interface
    Specifies the logical interface name of the parent (or master) interface this route belongs to; must refer to one of the defined interface sections,这条路由规则走的设备,例如我们需要将一些流量转发到wanb对应的网络,这里就要选wanb
  • Target
    Network address,如果选择wanb,这个就是wanbi连接后,对方网络的私网网段
  • IPv4-Netmask
    Route netmask. If omitted, 255.255.255.255 is assumed which makes target a host address,对方私网网段的掩码,如果忽略则使用255.255.255.255,这种情况下target就是一个IP地址而不是范围
  • IPv4-Gateway
    Network gateway. If omitted, the gateway from the parent interface is taken if any, otherwise creates a link scope route; if set to 0.0.0.0 no gateway will be specified for the route,wanb连接后看到的对方的IP,即wanb这个IP对应的网关的IP,如果忽略则使用interface的网关IP,或者创建一个link scope route;如果设为0.0.0.0则这条路由没有网关。
  • Metric
    越小重要性越高
  • MTU
  • Route type
    一般用单播unicast

例子:https://openwrt.org/docs/guide-user/network/ipv4/routing_in_ipv4

posted on 2021-01-28 01:15  Milton  阅读(4817)  评论(0编辑  收藏  举报

导航