OKNET
June 22, 2015, 6:31am
1
I have to manage two different lan subnet with the same routerboard device, each one with its default gateway (0.0.0.0 route)
i.e. :
eth1 192.168.1.1 (default gateway for this lan) 0.0.0.0/0.0.0.0 routed to 10.0.0.254 attached to eth2 (10.0.0.1)
eth3 192.168.2.1 (default gateway for this lan) 0.0.0.0/0.0.0.0 routed to 20.0.0.254 attached to eth4 (20.0.0.1)
How can I accomplish this at the same time ??
Thank you.
OKNET
June 24, 2015, 11:43am
2
Any suggestion ?
It makes me think question is too much simple one can imagine I can sove it myself…(perhaps you’re ok.. )
When I add a new route , I can set a dst address and a gateway , but no a source address or network,
It would be easy if one can set
source a.a.a.a/24 dst 0.0.0.0/0 gateway a.a.a.z
source b.b.b.b/24 dst 0.0.0.0/0 gateway b.b.b.z
but it seems not possible in route configuration, should I work around routing mark instead ??
Thank you
With default config, eth3,4,5 are slave ports to eth2.
Using Winbox, go to Interfaces > Interface and edit eth2,3,4 and 5. In the “Master Port” dropdown, set it to None.
Go to IP > Addresses, remove default entries.
Add entry, IP 192.168.1.1, interface Eth1
Add entry, IP 10.0.0.1, interface Eth2
Add entry, IP 192.168.2.1, interface Eth3
Add entry, IP 20.0.0.1, interface Eth4
To make Lan #1 go out Wan #1 , and Lan #2 go out Wan #2 , you have to mark packets coming in on eth1 and eth3
Go to IP > Firewall, Mangle
Add entry, Chain=prerouting, in-interface: eth1, action: mark routing, New Routing Mark: LAN1
Add entry, Chain=prerouting, in-interface: eth3, action: mark routing, New Routing Mark: LAN2
Packets leaving a gateway must be masqueraded (so the outbound packets take on the wan interface’s IP).
Go to IP > Firewall, NAT
Remove default masquerade rule
Add entry, chain: srcnat, Out-Interface: Eth2, Action: Masquerade
Add entry, chain: srcnat, Out-Interface: Eth4, Action: Masquerade
Because you use static IPs for your WANs, you need to manually create the routes
Go to IP > Routes
Add Entry, Dst. Address: 0.0.0.0/0, Gateway: 10.0.0.254, Routing Mark: LAN1
Add Entry, Dst. Address: 0.0.0.0/0, Gateway: 20.0.0.254, Routing Mark: LAN2
I believe that’s it.
OKNET
August 6, 2015, 9:16am
4
I was been away for a time.
Van , let me thank you now…
Very helpful