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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM