I want to run personal and business wifi on one network. Personal will use 172.23.128.0/24 as backbone and business will use 10.0.0.0/24 as backbone.
On router 1 i will do the following.
ip address add address=172.23.128.1/30 interface=wlan1
ip address add address=10.0.0.1/30 interface=wlan1
ip address add address=172.16.0.1/24 interface=ether1
ip firewall mangle add src-address=192.168.0.0/24 chain=prerouting action=mark-routing new-routing-mark=business
ip firewall mangle add src-address=192.168.10.0/24 chain=prerouting action=mark-routing new-routing-mark=personal
ip route add dst-address=192.168.0.0/24 gateway=10.0.0.
ip route add dst-address=192.168.10.0/24 gateway=172.23.128.2
ip route add gateway=172.16.0.200 routing-mark=business
ip route add gateway=172.16.0.201 routing-mark=personal
ip route rule add src-address=192.168.0.0/24 routing-mark=business table=business
ip route rule add src-address=192.168.10.0/24 routing-mark=personal table=personal
On router 2 i will do the following.
ip address add address=172.23.128.2/30 interface=wlan1
ip address add address=10.0.0.2/30 interface=wlan1
ip address add address=192.168.0.1/24 interface=ether1
ip address add address=192.168.10.1/24 interface=ether2
ip firewall mangle add src-address=192.168.0.0/24 chain=prerouting action=mark-routing new-routing-mark=business
ip firewall mangle add src-address=192.168.10.0/24 chain=prerouting action=mark-routing new-routing-mark=personal
ip route add dst-network=0.0.0.0/0 gateway=172.23.128.1 routing-mark=personal
ip route add dst-network=0.0.0.0/0 gateway=10.0.0.1 routing-mark=business
ip route rule add src-address=192.168.0.0/24 routing-mark=business table=business
ip route rule add src-address=192.168.10.0/24 routing-mark=personal table=personal
Here is the problem that i get. The problem is on router2…When both default gateways have routing-marks then the network goed down. If only one of the gateway have routing marks then they bot use the other gateway(the one without the routing mark)
Maybe I misunderstood. There is no internet connection? Just two localnets?
ADD: I think I see now. Both the gateways are on the same interface. Then you need to decide which gateway you want as default, and remove the routing mark from it.
On router 1
ip route add gateway=172.16.0.200 routing-mark=business
ip route add gateway=172.16.0.201 routing-mark=personal
172.16.0.200 is gateway for business
172.16.0.201 is gateway for personal.
If i setup only router 1 with above settings then internet works, but when i setup routing marks and gateways with routing marks on router2 then i cannot ping other side
Then those you are currently using are the correct settings. DNS may not work tho. Neither will NTP. You might want to routing-mark the router’s ips too. Just a thought…
ADD: This is a typo, not the setting, correct?
ip route add dst-address=192.168.0.0/24 gateway=10.0.0.
The ping must go through the 10.0.0.x net to get to router 2 localnet. On return, there is no gateway for the 10.0.0.x net.
I did some tests yesterday. I created one routing-mark with one gateway on router1. And created a default gateway on second router. Networks was pinging fine until i added routing-marks, routing rules and mangle rules.
If i setup router 1 with above then the packets do go through the correct gateway at the end. But this will mean that i can only have one gateway on the other router and both networks will go though the same gateway on router 2. I dont want the networks to be aware of each other, they should not be able to ping or connect to each other.
You are making this more difficult than it should be. Which gateway do you want the routers to use for dns, ntp and the like? My advice is to remove the routing-mark from that gateway on both routers. ADD: You can block the connection between the two networks with “/ip firewall filter” settings.
Now you’re thinking! You want them to work perfect if they are not blocked by the firewall filter.
/ip firewall filter
add chain=forward src-address=xx.xx.xx.00/24 dst-address=yy.yy.yy.00/24 action=drop
add chain=forward src-address=yy.yy.yy.00/24 dst-address=xx.xx.xx.00/24 action=drop
Replace xx.xx.xx.00/24 with one localnet, and yy.yy.yy.00/24 with the other. Add more as needed.