Answer the question
In order to leave comments, you need to log in
How to wrap certain sites on an external proxy on Mikrotik?
There is Mikrotik 6.32 on x86
How to make it so that when someone on the home network wants to go to the site yandex.ru, mikrotik wraps it up and Yandex opens through this very external proxy?
PS I tried to use ppptp vpn instead of a proxy, but for some reason the traffic simply does not go through the pptp connection...
Answer the question
In order to leave comments, you need to log in
If there is a specific list of sites, then the most correct solution would be to first resolve the names of these sites to a specific list address. For this purpose, I found a wonderful script.
:local DNSList {"example.com";"non-exist.domain.net";"server.local";"hostname"}
:local ListName "MyList"
:local DNSServers ( [ip dns get dynamic-servers], [ip dns get servers ], 8.8.8.8 )
:foreach addr in $DNSList do={
:foreach DNSServer in $DNSServers do={
:do {:resolve server=$DNSServer $addr} on-error={:log debug ("failed to resolve $addr on $DNSServer")}
}
}
/ip firewall address-list remove [find where list~$ListName]
/ip dns cache all
:foreach i in=[find type="A"] do={
:local bNew true
:local cacheName [get $i name]
:local match false
:foreach addr in=$DNSList do={
:if (:typeof [:find $cacheName $addr] >= 0) do={
:set $match true
}
}
:if ( $match ) do={
:local tmpAddress [/ip dns cache get $i address]
:if ( [/ip firewall address-list find ] = "") do={
:log debug ("added entry: $[/ip dns cache get $i name] IP $tmpAddress")
/ip firewall address-list add address=$tmpAddress list=$ListName comment=$cacheName
} else={
:foreach j in=[/ip firewall address-list find ] do={
:if ( [/ip firewall address-list get $j address] = $tmpAddress ) do={
:set bNew false
}
}
:if ( $bNew ) do={
:log debug ("added entry: $[/ip dns cache get $i name] IP $tmpAddress")
/ip firewall address-list add address=$tmpAddress list=$ListName comment=$cacheName
}
}
}
}
/ip firewall nat add action=dst-nat chain=dstnat comment=MyProxy disabled=no dst-address-list=MyList dst-port=80,443 \
protocol=tcp to-addresses=<адрес прокси>
src-address=!<ip-адрес вашего прокси>
if the proxy is on the same network as other home computers. If it is somewhere outside the home network, this is not required. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question