Community discussions

MikroTik App
 
jo2jo
Forum Guru
Forum Guru
Topic Author
Posts: 1003
Joined: Fri May 26, 2006 1:25 am

2 Public Gateways?

Fri Sep 09, 2011 11:13 am

Hi, I just got a RB1200 at one of my datacenters for my colo servers.

There are 2 servers plugged into the rb1200
server a : 192.168.88.2/24 (rb1200 ip 192.168.88.1 )
server b: 192.168.97.2/24 (rb1200 ip 192.168.97.1 )

There are 2 Public IP up-links going to the rb1200
up-link a : 69.25.54.146/29 (.146 is what the rb1200 is set to with gateway= 69.25.54.145 )
up-link b : 69.25.54.155/29 (.155 is what the rb1200 is set to with gateway= 69.25.54.154 ).


How do I craft nat / mange rules so that any public traffic coming into Uplink A only uses gateway 54.145 on the way out and so that Server A (88.2) only uses Up-link A (54.145) for public internet traffic?

also the same for server B:
Server B (97.2) only uses Up-link B (54.154) for public internet traffic?
--

for example right now if i connect via winbox to the rb1200 via ip 69.25.54.155 you dont see any TX on that Ethernet port as the routers' default gateway is set to 69.25.54.145 (so the traffic for 69.25.54.155 and 69.25.54.146 goes out gateway 69.25.54.145)

RouteOS 5.5

Thanks alot for the help!
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: 2 Public Gateways?

Fri Sep 09, 2011 4:35 pm

Look up policy routing on the wiki.

The basic idea is to use mangle rules to mark connections when they're being established, and then use the connections marks to apply routing marks to all packets in the connection. You can then use routes for those routing marks to force traffic out a specific route.

The PCC wiki is a good start - it really is just a very nice example of policy routing, where the policy is established via the PCC lines that spread traffic across multiple available circuits.
 
jo2jo
Forum Guru
Forum Guru
Topic Author
Posts: 1003
Joined: Fri May 26, 2006 1:25 am

Re: 2 Public Gateways?

Sun Sep 25, 2011 4:12 am

Hey, Ive tried for days to implement the wiki policy routing but ive never been able to get it.

Can some one help me with just this speicifically:

if src IP address is 192.168.97.2 than route via public gateway 2 (64.54.55.2 for example).

thanks very much!
 
jo2jo
Forum Guru
Forum Guru
Topic Author
Posts: 1003
Joined: Fri May 26, 2006 1:25 am

Re: 2 Public Gateways?

Sun Sep 25, 2011 4:16 am

i got it! i had the gateway IP wrong, i knew i had the simple mangle rules done properly.

you need to makr connection of src IP and in interface, then in 2nd rule mark routing of any packets with the connection mark set in rule 1 to routingmarkX.

then set your gateway to only be used for routing mark set in rule 2
 
sagabi99
just joined
Posts: 8
Joined: Mon Nov 12, 2007 7:03 pm

Re: 2 Public Gateways?

Thu Sep 29, 2011 2:50 am

cool thanks for the post,
can you post your configs,
i'm trying to do something similar, but based on destination ip to get it routed thru vpn i.e pptp connection and make all other traffic to go to default.

Thanks
 
jo2jo
Forum Guru
Forum Guru
Topic Author
Posts: 1003
Joined: Fri May 26, 2006 1:25 am

Re: 2 Public Gateways?

Thu Sep 29, 2011 3:03 am

Thats what i was looking for in my orginal post but ppl are hesitant to post configs here, anyway here is my config i just ended up doing simple routing marks which are not in the wiki (the wiki is a better setup that allows true load balencing and failover.)

but in my sistuation i was simply routing one virual machine out one speicfic public gate way and subnet (a small /29 public subnet).

this works great, up to full 100mbit usage on a RB 1200 (still low cpu usage too):

you also have to add a ip route DST 0.0.0.0/0 gateway (your other public IP gateway) ROUTING MARK= "use 154"

and i have as nat masq action out interface that router is plugged to public IP on.

and finally i have the public ip i want the VM server (which is at 192.168.97.3) added in ip address on the RB 1200 router.

one eth interface goes to server, one goes to public IP uplink. (i also have other of these confgs setup on this same 11 port RB 1200 router and it works great)

add action=mark-connection chain=prerouting disabled=no in-interface=\
    ether3-to-ETH1-97ip new-connection-mark="use 154" passthrough=yes \
    src-address=192.168.97.3

add action=mark-routing chain=prerouting connection-mark="use 154" disabled=\
    no in-interface=ether3-to-ETH1-97ip new-routing-mark=route_via_154 \
    passthrough=yes

Who is online

Users browsing this forum: litogorospe and 139 guests