Community discussions

MikroTik App
 
riaanmaree
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Thu Aug 31, 2006 10:42 pm
Location: Johannesburg, South Africa
Contact:

SRC NAT for output chain??

Thu Apr 18, 2013 9:51 am

Have have recently been assigned public IPs to our network and are using them for customers. We are still using a lot of private IPs inside our network, especially between highsites.

We have a SRC NAT rule to still Masquerade all traffic leaving our network and coming from the internal private IPs. So this NATs everything but our Public IPs.

We also have local loopback IPs assigned to a bridge interface (no ports added to bridge) for OSPF and BGP to work better.


What we would like to do is to have all traffic originating from the router (DNS requests, RADIUS communication, etc) that leaves our network to srcnat (come from) the public IP assigned on the loopback interface. How can we do this without effecting traffic passing through the router (forward chain) from other towers?

The main reason why we want to do this is because our RADIUS servers are hosted outside of our network. When adding all our towers/routers to the RADIUS server, you have to specify the source IP address so disconnect packets can be sent back to the router when a customer reach their service limit or get suspended for not paying. So having a single public IP for each tower where RADIUS communication comes from is the ideal solution.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: SRC NAT for output chain??

Thu Apr 18, 2013 10:39 am

you should be able to mark packets in mangle output chain and then src-nat them to address you like based on that mark you set up.
 
riaanmaree
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Thu Aug 31, 2006 10:42 pm
Location: Johannesburg, South Africa
Contact:

Re: SRC NAT for output chain??

Thu Apr 18, 2013 10:34 pm

Oh yes! That'll work. Thanks!
 
ozzyBLR
just joined
Posts: 5
Joined: Fri Oct 23, 2020 10:38 am

Re: SRC NAT for output chain??

Fri Oct 23, 2020 10:44 am

Could you please provide a more detailed solution? I'm currently facing the same issue. I've created a mangle rule to mark traffic on the output chain. With the logging turned on I can see the mangle rule catching the traffic. Then I try to create a src-nat rule to catch the marked traffic and change its source address but nothing happens.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: SRC NAT for output chain??

Fri Oct 23, 2020 5:15 pm

That srcnat needs only one condition (connection-mark=<your mark>), so that's hard to mess up. Also don't forget that order of rules matters, they are processed from top to bottom and first matching one is used.
 
ozzyBLR
just joined
Posts: 5
Joined: Fri Oct 23, 2020 10:38 am

Re: SRC NAT for output chain??

Thu Oct 29, 2020 7:55 am

Yeah, mangle rule and src-nat seem to be working fine. The torch tool shows me that i receive responses to my substitutional address. But they're not being translated back to the original address.
I think i'd better start a new topic concerning my issue. Cause there're some configurational aspects that might affect the situation.

Who is online

Users browsing this forum: Bing [Bot], mansuramir, Nukleari, Zilch and 113 guests