Hello!
I have OpenWrt Attitude Adjustment 12.09.1 and a device with two WANs with the same gateway:
WAN1. Ethernet with static IP - 192.168.3.111, gateway 192.168.3.1 (hostname ibm_pc_xt), metric 10;
WAN2. Wi-Fi with static IP - 192.168.3.222, gateway 192.168.3.1 (hostname ibm_pc_xt), metric 20.
My /etc/config/network is:
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'wan1'
option ifname 'eth0'
option proto 'static'
option ipaddr '192.168.3.111'
option netmask '255.255.255.0'
option gateway '192.168.3.1'
option dns '192.168.3.1'
option send_rs '0'
option metric '10'
config interface 'wan2'
option proto 'static'
option netmask '255.255.255.0'
option gateway '192.168.3.1'
option dns '192.168.3.1'
option send_rs '0'
option ipaddr '192.168.3.222'
option metric '20'
My /etc/config/wireless is
config wifi-device 'wlan0'
option type 'mac80211'
option disabled '0'
option channel 'auto'
config wifi-iface
option ssid 'Wnet'
option encryption 'psk2'
option device 'wlan0'
option mode 'sta'
option network 'wan2'
option key '_keykeykeykey_'
If I connect Ethernet cable and setup Wi-Fi I get 4 lines in route table:
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default ibm_pc_xt 0.0.0.0 UG 10 0 0 eth0
default ibm_pc_xt 0.0.0.0 UG 20 0 0 wlan0
192.168.3.0 * 255.255.255.0 U 10 0 0 eth0
192.168.3.0 * 255.255.255.0 U 20 0 0 wlan0
and I can ping from both devices:
ping -c1 google.com -I eth0
PING google.com (173.194.47.166): 56 data bytes
64 bytes from 173.194.47.166: seq=0 ttl=56 time=10.085 ms
--- google.com ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 10.085/10.085/10.085 ms
ping -c1 google.com -I wlan0
PING google.com (173.194.32.136): 56 data bytes
64 bytes from 173.194.32.136: seq=0 ttl=56 time=18.184 ms
--- google.com ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 18.184/18.184/18.184 ms
If I disconnect Ethernet cable I can't ping by hostname, only by IP with wlan0 specified:
ping -c1 google.com -I wlan0
ping: bad address 'google.com'
ping -c1 8.8.8.8 -I wlan0
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=48 time=27.355 ms
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 27.355/27.355/27.355 ms
If wlan0 is not specified I can't ping:
ping -c1 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
ping -c1 google.com
ping: bad address 'google.com'
So I have two questions:
1. Is it possible to correctly setup two WANs with the same gateway?
2. Is it possible to use WAN2 (Wi-Fi) only if WAN1 (Ethernet) is not available?
I read about multiwan and mwan3. But it seems that they does not solve my problem.
Do I need to write special script/program or I can use existent ones?
What do you recommend?
With best regards,
Norko.
(Last edited by norko.solko on 24 Aug 2013, 22:36)