Community discussions

MikroTik App
 
leopepe
just joined
Topic Author
Posts: 3
Joined: Mon Jul 21, 2008 5:59 am

Port forwarding

Mon Jul 21, 2008 6:14 am

Hi Everybody, what's up? I'm working with Mikrotiks routers for some time but I'm having problems with port forwarding and that's why i'm contacting you.

Let's start, I have some servers behing a Mikrotik RB 150, I've fordwarded the ports like everybody does with a NAT rule and it works great.
;;;; Server 
chain=dstnat action=dst-nat to-addresses=192.168.x.x to-ports=80 dst-address=xxx.xxx
.xxx.xxx dst-port=80 protocol=tcp 

(the x is just to not show the IP)

But the problem is around the logs in the server. As it's a NAT, all the  external IPs (public IPs) from internet are changed to Gateway's IP of the  internal network. So then, all the logs have as IP 192.168.x.x (private)  instead of the real external public IP of the visitor.

I have no idea how to solve this. I mean, that my
Apache server log the  public IPs instead of the private one. 

Any clue? Did anybody had this problem?

Thanks and hope I've been clear with the problem.
 
User avatar
n2m
newbie
Posts: 47
Joined: Mon Feb 25, 2008 8:48 am

Re: Port forwarding

Mon Jul 21, 2008 9:27 am

Yes this is interesting and it would be great if it could be done without assigning a public ip to the webserver. I have set a webserver like this too but this problem causes me some other problems with web aplications. I hope someone knows if it can be done anything!
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Port forwarding

Mon Jul 21, 2008 10:21 am

leopepe, just disable a rule that masquerades all packets on your _internal_ interface - why do you need it at all?
 
leopepe
just joined
Topic Author
Posts: 3
Joined: Mon Jul 21, 2008 5:59 am

Re: Port forwarding

Mon Jul 21, 2008 7:52 pm

OK, it's works.

It is my new masquerade Rule.
chain=srcnat action=masquerade src-address=192.168.1.1-192.168.1.254
If I just disable this rule, the port forwarding works, but the servers can't conect to Internet.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Port forwarding

Wed Jul 23, 2008 7:04 pm

Personally I prefer to use 'out-interface=your_uplink' instead of 'src-address='
 
leopepe
just joined
Topic Author
Posts: 3
Joined: Mon Jul 21, 2008 5:59 am

Re: Port forwarding

Wed Jul 23, 2008 10:30 pm

Yes, I now. It's the best option, but I don't have time. I use the first option than works, in some days maybe i will change to 'out-interface'.

Thanks.