Community discussions

MikroTik App
 
evilheart
newbie
Topic Author
Posts: 47
Joined: Thu Jul 02, 2015 9:41 pm

POSTROUTING

Tue Aug 16, 2016 1:37 am

hello i have this comment centos is have any commond have mikrotik like this use postrouting
iptables -t nat -A POSTROUTING -s 192.168.1.20 -o venet0 -j SNAT --to-source 10.10.10.99
iptables -t nat -A POSTROUTING -s 192.168.1.21 -o venet0 -j SNAT --to-source 10.10.10.100

2 ip connection ..

for explain
username1 : when connection show : 10.10.10.99
username2 : when connection show : 10.10.10.100
 
Sob
Forum Guru
Forum Guru
Posts: 9188
Joined: Mon Apr 20, 2009 9:11 pm

Re: POSTROUTING

Tue Aug 16, 2016 3:26 am

It's very similar in RouterOS:
/ip firewall nat
add action=src-nat chain=srcnat out-interface=venet0 src-address=192.168.1.20 to-addresses=10.10.10.99
add action=src-nat chain=srcnat out-interface=venet0 src-address=192.168.1.21 to-addresses=10.10.10.100
 
evilheart
newbie
Topic Author
Posts: 47
Joined: Thu Jul 02, 2015 9:41 pm

Re: POSTROUTING

Thu Aug 18, 2016 10:37 pm

its not working :s
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: POSTROUTING

Fri Aug 19, 2016 12:40 am

Make sure the out-interface is set correctly to an IP interface.
If you have a bridge interfaces, then never specify the physical interfaces that are ports of the bridge for IP features (nat, firewall, dhcp, etc) - specify the bridge interface.
If pppoe interface, then use the pppoe interface itself in your nat rules
Etc.

In fact, you could probably get away with not even specifying an interface in your two sample rules, unless you have multiple LAN segments and you don't want to NAT when going between the lan segments....