I've managed to setup openwrt with 2 wan.
both wan is dhcp enabled.
and i've already setup different metric on both wan and also both have different gateway.
the problem is, openwrt always know only 1 route gateway, that means i cannot ping any clients behind wan2, but i can ping all clients behind wan1. i also can ping both gateway ip address with success.
ip route show
default via 10.1.22.1 dev eth0 proto static src 10.1.22.76 metric 10
default via 192.168.10.1 dev wlan0 proto static src 192.168.10.3 metric 20
root@OpenWrt:~# ping 10.1.22.1
PING 10.1.22.1 (10.1.22.1): 56 data bytes
64 bytes from 10.1.22.1: seq=0 ttl=64 time=2.372 ms
64 bytes from 10.1.22.1: seq=1 ttl=64 time=2.350 ms
64 bytes from 10.1.22.1: seq=2 ttl=64 time=2.349 ms
^C
--- 10.1.22.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 2.349/2.357/2.372 ms
root@OpenWrt:~# ping 192.168.10.1
PING 192.168.10.1 (192.168.10.1): 56 data bytes
64 bytes from 192.168.10.1: seq=0 ttl=64 time=4.037 ms
64 bytes from 192.168.10.1: seq=1 ttl=64 time=1.294 ms
^C
how to ping on both wan in openwrt as on mikrotik it's easy to setup it to give "/ip firewall route" on each others.
i just set static ip route on openwrt but not success.. also i already installed mwan3 but also no success.
please any expert here can give me clear instructions.
thanks in advance...
You told OoenWrt that everything is behind 10.1.22.1, and everything is also behind 192.168.10.1, but it should chose the first gateway whenever possible. Do you see the issue here? How can OpenWrt know when to use the second gateway?
You should define appropriate routes for each network, so the router knows when to use each one, and define only one default gateway, unless you need a backup.
Gateway 192.168.10.1 has internet access.
Gateway 10.1.22.1 no internet, only voip gateway server.
So when i ping www.yahoo.com, openwrt must know which gateway should be used, that's 192.168.10.1 gateway. If i ping 10.0.0.10, openwrt will use 10.1.22.1 gateway.
How to setup route for 2 gateway which can be used at the same time?
Does mwan3 package will solve this problem? I've setup mwan3 but still not working..
In that case, 10.1.22.1 should not be configured as a "default" gateway, just as a gateway for whatever network is behind it (10.0.0.0/24, usually).
The router will first select all gateways that match the destination address, then select those with the most restricted mask, then the one with the lower path. In your case, since www.yahoo.com can be reached only through 192.168.10.1, it will use that gateway
You need two routes:
One uses gateway 10.1.22.1 with a mask of 255.0.0.0 (I guess)
The other one uses gateway 192.168.10.1 with a default mask (0.0.0.0).
If I got what you want, you need to reach Internet through 192.168.10.1 and the network 10.0.0.0/8 through 10.1.22.1. If this is the case, you must create the default route to 192.168.10.1 and a route for net 10.0.0.0/24 by doing:
ip r add default via 192.168.10.1 (Set default route to 192.168.10.1)
ip r add 10.0.0.0/8 via 10.1.22.1 (Set route to any 10.0.0.0/8 to 10.1.22.1)
Yes.. that's what i want.
So i can ping 10.0.0.0/8 and have internet access. But in order to ping 10.0.0.0/8 i have to set gateway 10.1.22.1 which no internet access.. please give me the config code.. thanks
wwan dhcp get ip address 192.168.10.0/24 gateway 192.168.10.1 which can access internet
wan dhcp get ip address 10.1.22.0/24 gateway 10.1.22.1 (only voip server no internet access)
i can ping both gateway, but only 1 gateway active.. if set lower metric to wan, then i can't access internet since the active gateway is 10.1.22.1.
First add an "option defaultroute 0" line to your WAN interface, so is not configured as a default route. You should now be able to browse the internet using the WWAN interface.
If you cannot reach devices on the WAN network, add a "option customroutes '10.0.0.0/8'" line, too.
if i put defaultroute '0' on WAN interface, then how do openwrt know if i ping to 10.0.0.0/8 then it will use gateway 10.1.22.1 ?
which value to be added in option customroutes ? the gateway 10.1.22.1 or the range ip address i wish to ping such as 10.0.0.0/8 ?
sorry, i'm still blur...
But "defaultroute" means "everything else goes here", and you do not want to use WAN for "everything else", just "the rest of 10.0.0.0", and that is why you need a specific route.
The gateway is obtained via DHCP, so you just need (but only if the first step is not enough) to specify the network range.
I tried using customroutes and it success.. now can ping 10.0.0.0/8 and also have internet access.. but why when i ping to 10.0.0.0/8 seems sometimes not quite good.. seems like less rto. But latency is less than 100ms. Previously config while using only 1 gateway for WAN, ping is very good..