Community discussions

MikroTik App
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
加入: Tue Apr 29, 2008 3:38 am
Location:Karachi, Pakistan
Contact:

Routing with original source address

Sat May 23, 2009 7:39 am

Hi,

I would like to know, is it possible to route port 80 traffic to an external machine with original src-address. I am talking about an external proxy / cache machine, mikrotik routing port 80 traffic with original src-address to an external machine.
Top
用户头像
Chupaka
Forum Guru
Forum Guru
Posts: 8689
加入: Mon Jun 19, 2006 11:15 pm
Location:Minsk, Belarus
Contact:

Re: Routing with original source address

Sat May 23, 2009 8:50 pm

add route with gateway=your_proxy_machine, mark packets to route with this routing table
Top
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
加入: Tue Apr 29, 2008 3:38 am
Location:Karachi, Pakistan
Contact:

Re: Routing with original source address

Sun May 24, 2009 3:46 am

Dear chupaka,

i tried this, but the traffic that i recieve at proxy has the src address of my mikrotik machine, not the original host machine.
Top
andreacoppini
Trainer
Trainer
Posts: 498
加入: Wed Apr 13, 2005 11:51 pm
Location:Malta, Europe

Re: Routing with original source address

Sun May 24, 2009 5:18 am

then you probably have a NAT rule translating the src-address. Check your MikroTik NAT rules.
Top
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
加入: Tue Apr 29, 2008 3:38 am
Location:Karachi, Pakistan
Contact:

Re: Routing with original source address

Sun May 24, 2009 8:54 am

Hi,

yes i have a "masquerade" rule in my NAT table, without it internet will not work at the client side.

If you have any other method then "masquerade" please let me know, becasue it will help me in obtaining the desired result
Top
andreacoppini
Trainer
Trainer
Posts: 498
加入: Wed Apr 13, 2005 11:51 pm
Location:Malta, Europe

Re: Routing with original source address

Sun May 24, 2009 1:34 pm

create a new rule before the masquerade

src-address=your internal LAN
dst-protocol=tcp
dst-port=80
action =接受
Top
用户头像
Chupaka
Forum Guru
Forum Guru
Posts: 8689
加入: Mon Jun 19, 2006 11:15 pm
Location:Minsk, Belarus
Contact:

Re: Routing with original source address

Sun May 24, 2009 3:14 pm

yesss, you should not masquerade http traffic to your proxy. is it Balabit TProxy? please describe your configuration
Top
kiket
频率uent Visitor
频率uent Visitor
Posts: 56
加入: Thu Mar 02, 2006 5:32 pm

Re: Routing with original source address

Wed May 27, 2009 10:42 pm

--- SOLVED ---

Hi all,

I have the same problem. I want to log the users IP in IPCOP (Squid).

Anyone can help us?.

Thanks in advance.
Top
用户头像
hilton
Long time Member
Long time Member
Posts: 634
加入: Thu Sep 07, 2006 5:12 pm
Location:Jozi (aka Johannesburg), South Africa

Re: Routing with original source address

Thu May 28, 2009 3:50 pm

yesss, you should not masquerade http traffic to your proxy.
Chupaka, are you referring to internal proxy servers (on the LAN) or to only external ones?

I don't see how any http traffic would reach the external proxy server is masquerading is turned off. Unless I need a rule like andreacoppini mentioned. But I can only see this making a difference if it's internal.
Top
andreacoppini
Trainer
Trainer
Posts: 498
加入: Wed Apr 13, 2005 11:51 pm
Location:Malta, Europe

Re: Routing with original source address

Thu May 28, 2009 4:29 pm

If your proxy server is not internal, then how will it be able to send the replies back to the internal clients?

the proxy server needs to have a route into your internal network. This can be done either by masquerading to the router's public IP (but then all requests will be coming from that single IP) or by setting a route on the external proxy back to your internal network.

You could also do one-to-one NAT, although that would defeat the scope of having a masquerade rule in the first place
Top
用户头像
Chupaka
Forum Guru
Forum Guru
Posts: 8689
加入: Mon Jun 19, 2006 11:15 pm
Location:Minsk, Belarus
Contact:

Re: Routing with original source address

Thu May 28, 2009 4:32 pm

Chupaka, are you referring to internal proxy servers (on the LAN) or to only external ones?

I don't see how any http traffic would reach the external proxy server is masquerading is turned off. Unless I need a rule like andreacoppini mentioned. But I can only see this making a difference if it's internal.
if you are using external proxy, you cannot send packets with original client's IP address unless you are using public IP range. if you are using public IP range, you do not need masquerade =)
Top
用户头像
hilton
Long time Member
Long time Member
Posts: 634
加入: Thu Sep 07, 2006 5:12 pm
Location:Jozi (aka Johannesburg), South Africa

Re: Routing with original source address

Thu May 28, 2009 4:55 pm

So if I was trying to automatically redirect port 80 traffic on my LAN to another internal proxy server, I would add this rule BEFORE my normal masquerade rule?

src-address=your internal LAN
dst-protocol=tcp
dst-port=80
action =接受

这将有效地“接受”的所有流量for port 80 and would then NOT change the source IP address and would then be redirected to my internal proxy by my second dst-nat rule?

When the proxy in turn redirects the request to the internet this traffic will be caught by the normal src-nat masquerade rule?

Am I making sense?
Top
用户头像
Chupaka
Forum Guru
Forum Guru
Posts: 8689
加入: Mon Jun 19, 2006 11:15 pm
Location:Minsk, Belarus
Contact:

Re: Routing with original source address

Fri May 29, 2009 12:51 am

something like this. it depends on your network structure
Top
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
加入: Tue Apr 29, 2008 3:38 am
Location:Karachi, Pakistan
Contact:

Re: Routing with original source address

Tue Jun 02, 2009 9:27 am

Hi,

Thanks to all, i have resolved my problem.
Thanks again.
Top
ferdous
刚刚加入了
Posts: 19
加入: Mon May 25, 2009 6:59 pm

Re: Routing with original source address

Sat Jun 06, 2009 4:17 pm

hi mudasir , how did u solve ur problem . will u plz post ur configuration.
Top
mudasir
Member Candidate
Member Candidate
Topic Author
Posts: 278
加入: Tue Apr 29, 2008 3:38 am
Location:Karachi, Pakistan
Contact:

Re: Routing with original source address

Sat Jun 06, 2009 4:40 pm

Its simple.

In mangle table just add a simple rule to accept traffic of port 80....
Top

Who is online

Users browsing this forum:gandlz,nediisand 2 guests