How to Verify an answering port

Hi, i have a linux based proxy running with mikrotik server.. all works fine until the proxy server for one reason or another..get over off the squid!

My question is, anyone knows if there is a way to check the proxy port, and then disable all redirect rules, to keep the service running. The only way i can do this is with the netwatch, but only if the machine freeze or shutdown.. i know how to do this on linux, using netstat .. but in mikrotik i dont…

Any help will be welcome!^^

thanks for the time!

when using squid i setup wccp to send out “hello” packets and capture the packet(udp 2048) and add it to a addresslist and from there use a script the enable/disable the redirect rule based on the wccp “hello” packet. Hope this helps

here is my setup from memory :confused:

mangle rule to create address list wccp

/ip firewall mangle
add chain=prerouting action=add-dst-to-address-list protocol=udp src-address=Your-Squid-IP address-list=wccp address-list-timeout=20s dst-port=2048 comment="Squid WCCP Hello Packet"

script to enable/disable http redirect rule

/system script
add name=httpredirect source="
:global pEvent
:if ([/ip firewall address-list find list=wccp] = "") do {
:if ($pEvent != "false") do={
/ip firewall nat disable [/ip firewall nat find comment="http_redirect"]
:set pEvent "false"
:log warning "Content Filter Lost"
}
} else={
:if ($pEvent != "true") do={ 
/ip firewall nat enable [/ip firewall nat find comment="http_redirect"]
:log info "Content Filter Found"
:set pEvent "true"
}

}"

scheduled event

/system schedule
add name=ProxyWatch interval=30s on-event=httpredirect

http redirect rule

/ip firewall nat
add chain=dstnat protocol=tcp dst-port=80 src-address=!Your-Squid-IP action=dst-nat to-addresses=Your-Squid-IP to-ports=3128(Squid Transparent Port) comment="http_redirect"

nice dude.. works like charm! very thanks!! solve my problem!