Community discussions

MikroTik App
 
pelli
newbie
Topic Author
Posts: 25
Joined: Fri Oct 07, 2011 5:06 pm

port forward lost source ip

Tue Aug 02, 2016 1:20 pm

hello,

this is my configuration

wan public ip 2.2.2.2
lan router ip 192.168.1.254
lan router ip mikrotik 192.168.1.1
lan internal mikrotik 192.168.10.1
lan internal server 192.168.10.200

i need to forward port 22 from wan to lan internal server

the port forward is ok but all ssh request have source ip 192.168.10.1 . is possible preserve original public ip that request ssh (ex 3.3.3.3 to 192.168.10.200)

Thanks
 
pe1chl
Forum Guru
Forum Guru
Posts: 10529
Joined: Mon Jun 08, 2015 12:09 pm

Re: port forward lost source ip

Tue Aug 02, 2016 5:00 pm

Normally that is what happens.
Probably you have done both srcnat and dstnat for the packet? (maybe as part of experimenting)
You need to do only dstnat to get the behaviour you want there.
 
User avatar
Deantwo
Member
Member
Posts: 332
Joined: Tue Sep 30, 2014 4:07 pm

Re: port forward lost source ip

Tue Sep 06, 2016 3:33 pm

the port forward is ok but all ssh request have source ip 192.168.10.1 . is possible preserve original public ip that request ssh (ex 3.3.3.3 to 192.168.10.200)
Sounds like your masquerade rule is the cause.
You should only let the masquerade rule apply to traffic leaving your WAN interface.

For example:
/ip firewall nat
add action=masquerade chain=srcnat out-interface=WAN
 
pelli
newbie
Topic Author
Posts: 25
Joined: Fri Oct 07, 2011 5:06 pm

Re: port forward lost source ip

Fri Sep 09, 2016 6:43 pm

the port forward is ok but all ssh request have source ip 192.168.10.1 . is possible preserve original public ip that request ssh (ex 3.3.3.3 to 192.168.10.200)
Sounds like your masquerade rule is the cause.
You should only let the masquerade rule apply to traffic leaving your WAN interface.

For example:
/ip firewall nat
add action=masquerade chain=srcnat out-interface=WAN
ok thanks

Who is online

Users browsing this forum: anav, parumuga and 34 guests