Is this possible in OpenWRT?
Yes.
# in /etc/config/network
config route
option interface 'isp2'
option target '0.0.0.0'
option netmask '0.0.0.0'
option table '2'
config rule
option in 'lan2'
option dest '0.0.0.0/0'
option priority '2'
option lookup '2'
config rule
option src '192.168.x.0/24'
option priority '3'
option lookup '2'
Where 192.168.x.0/24 is the subnet assigned to the network connected to lan2
/SSID-ISP-2
.
Thank you for your time and response. I still can't make it work.
I listed my whole config below, to be more specific.
In my case:
interface "lan" should route to "wwan1" (172.20.20.20/24)
interface "x" should route to "wwanIO5" (10.0.1.107/24)
What am I missing here ?
cat /etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fdbb:48c4:621d::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth1'
list ports 'eth1.1'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config device
option name 'br-wan'
option type 'bridge'
list ports 'eth0'
list ports 'eth0.2'
config interface 'wan'
option device 'br-wan'
option proto 'dhcp'
config interface 'wan6'
option device 'br-wan'
option proto 'dhcpv6'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '1 6t'
config switch_vlan
option device 'switch0'
option vlan '2'
option ports '2 0t'
config interface 'wwan'
option proto 'dhcp'
config interface 'guest'
option proto 'static'
option ipaddr '192.168.2.1'
list dns '1.1.1.1'
list dns '8.8.8.8'
option netmask '255.255.255.0'
config interface 'wwan1'
option proto 'dhcp'
config interface 'wwanIO5'
option proto 'dhcp'
config interface 'x'
option proto 'static'
list dns '1.1.1.1'
list dns '8.8.8.8'
option ipaddr '10.1.1.1'
option netmask '255.255.255.0'
config route
option interface 'x'
option target '0.0.0.0'
option netmask '0.0.0.0'
option table '2'
config rule
option in 'x'
option dest '0.0.0.0/0'
option priority '2'
option lookup '2'
config rule
option src '10.1.1.0/24'
option priority '3'
option lookup '2'
What am I missing here ?
What's not working?
Also provide /etc/config/wireless
Not guest?
config rule
option in 'guest' #<--- NOT x
option dest '0.0.0.0/0'
option priority '2'
option lookup '2'
It doesn't route based on the wifi that I use, still goes to default main table.
In my specific case:
connect to ssid "to_xfinity" route traffic to "xfinity" wwan
connect to ssid "to_io5" route traffic to "io5" wwanIO5
interface "lan" use wwan
interface "x" use wwanIO5
interface "guest" use whatever
guest is just for guests, I don't need to worry about that one, main route is fine unless I have to configure it too
/etc/config/wireless
config wifi-device 'radio0'
option type 'mac80211'
option path 'soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0'
option channel 'auto'
option band '2g'
option htmode 'HT20'
option cell_density '0'
config wifi-device 'radio1'
option type 'mac80211'
option path 'soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0'
option channel 'auto'
option band '5g'
option htmode 'VHT80'
option cell_density '0'
option country 'US'
config wifi-device 'radio2'
option type 'mac80211'
option path 'soc/1b900000.pci/pci0002:00/0002:00:00.0/0002:01:00.0'
option channel 'auto'
option band '5g'
option htmode 'VHT20'
option cell_density '0'
config wifi-iface 'wifinet3'
option device 'radio1'
option mode 'sta'
option network 'wwan'
option ssid 'xfinitywifi'
option bssid '0A:A7:C0:44:D1:7B'
option encryption 'none'
option macaddr 'D4:6E:0E:30:A3:05'
config wifi-iface 'wifinet1'
option device 'radio0'
option mode 'ap'
option ssid 'to_xfinity'
option encryption 'sae-mixed'
option key ''
option network 'lan'
config wifi-iface 'wifinet2'
option device 'radio0'
option mode 'ap'
option ssid 'ioguest'
option encryption 'sae-mixed'
option key ''
option network 'guest'
config wifi-iface 'wifinet5'
option device 'radio1'
option mode 'sta'
option network 'wwan1'
option ssid 'xfinitywifi'
option bssid '42:75:C3:0A:C3:08'
option encryption 'none'
option disabled '1'
config wifi-iface 'wifinet6'
option device 'radio2'
option mode 'sta'
option network 'wwanIO5'
option ssid 'io5'
option encryption 'psk2'
option key ''
config wifi-iface 'wifinet7'
option device 'radio0'
option mode 'ap'
option ssid 'to_io5'
option encryption 'none'
option network 'x'