Using multiple WAN IPs

  • Some users get from their ISP more than one routable public IP address.
  • Assume that the WAN IPs are 100.64.0.2/29, 100.64.0.3/29, etc.
  • Utilize multiple WAN IPs on the same interface.
  • Use a specific WAN IP for a specific LAN host.

Create an alias for the WAN interface.

uci -q delete network.wan3
uci set network.wan3="interface"
uci set network.wan3.proto="static"
uci set network.wan3.device="@wan"
uci set network.wan3.ipaddr="100.64.0.3/29"
uci commit network
service network restart

Configure destination and source NAT firewall rules.

uci -q delete firewall.dnat3
uci set firewall.dnat3="redirect"
uci set firewall.dnat3.name="DNAT3"
uci set firewall.dnat3.src="wan"
uci set firewall.dnat3.src_dip="100.64.0.3"
uci set firewall.dnat3.dest="lan"
uci set firewall.dnat3.dest_ip="192.168.1.3"
uci set firewall.dnat3.proto="all"
uci set firewall.dnat3.target="DNAT"
uci -q delete firewall.snat3
uci set firewall.snat3="nat"
uci set firewall.snat3.name="SNAT3"
uci set firewall.snat3.src="wan"
uci set firewall.snat3.src_ip="192.168.1.3"
uci set firewall.snat3.snat_ip="100.64.0.3"
uci set firewall.snat3.proto="all"
uci set firewall.snat3.target="SNAT"
uci commit firewall
service firewall restart
  • Last modified: 2023/10/14 06:10
  • by vgaetera