Common questions and answers about the WireGuard Endpoint Finder script.
The script automatically finds and configures working Cloudflare WARP endpoints for your MikroTik WireGuard connection. It tests random IP:port combinations until it finds one that works.
WARP endpoints can become unreachable due to:
- Network routing changes
- ISP blocking specific IPs
- Regional connectivity issues
- Cloudflare infrastructure changes
This script automatically finds alternatives without manual intervention.
Yes! The script:
- Only modifies WireGuard peer settings
- Creates temporary routes with automatic cleanup
- Includes comprehensive error handling
- Logs all actions for transparency
- Can be easily reversed
Briefly, yes. During testing:
- WireGuard peer is disabled/re-enabled (1-2 seconds per test)
- Typical total runtime: 10-60 seconds depending on attempts
- Existing connections will drop and reconnect
- Schedule during maintenance windows if concerned
Minimum: RouterOS 7.20
Recommended: Latest stable 7.x release
Not supported: RouterOS 6.x (lacks native WireGuard)
Yes. The script requires:
- WireGuard interface created
- At least one peer configured
- Basic WireGuard setup complete
See WireGuard Setup Guide for configuration.
/interface wireguard print
The output shows your interface name:
0 name="wgcf" mtu=1420 listen-port=51820
^^^^
This is your interface name
The script is optimized for Cloudflare WARP but can be adapted:
- Replace IP prefixes with your provider's endpoint IPs
- Update port list with your provider's ports
- Adjust test parameters as needed
Edit these arrays in the script:
:global ipPrefixes [:toarray "8.6.112.,162.159.192.,188.114.96."]
:global ports [:toarray "500,854,1701,2408,4500"]
Typical: 10-30 seconds
Maximum: 2-5 minutes (depends on maxAttempts)
Factors affecting speed:
- Network latency
- Number of attempts needed
delayTimesetting- Router CPU speed
Default: 25 attempts
Customize:
:local maxAttempts 50 # Try more endpoints
Success rate is typically 70-90% within 25 attempts.
Yes! Recommended schedule:
# Every 6 hours
/system scheduler add name="warp-finder" interval=6h \
on-event="/import warp-finder.rsc"
# Daily at 3 AM
/system scheduler add name="warp-finder-nightly" \
start-time=03:00:00 interval=1d \
on-event="/import warp-finder.rsc"
No. Recommendations:
- Every 6-12 hours: Proactive maintenance
- On connection failure: Reactive recovery via netwatch
- After router reboot: Via startup script
Avoid running more frequently than every hour.
CPU: Minimal (brief spikes during testing)
Memory: < 1 MB
Network: ~100 KB per test (ping packets)
Disk: None (script runs in memory)
Safe for resource-constrained routers.
Possible causes:
- Firewall blocking UDP traffic
- ISP blocking Cloudflare ranges
- Outdated IP/port lists
- WireGuard misconfiguration
Solutions:
# Check firewall rules
/ip firewall filter print where chain=output
# Allow WireGuard UDP
/ip firewall filter add chain=output action=accept protocol=udp
# Increase attempts
:local maxAttempts 50
# Update endpoint lists (check Cloudflare docs)
Error: "syntax error"
Cause: Incomplete copy/paste or file corruption
Fix: Re-download and try again
Error: "expected end of command"
Cause: RouterOS version too old
Fix: Upgrade to RouterOS 7.20+
Cause: Route configuration or test address unreachable
Fix:
# Try different test address
:local checkAddress "8.8.8.8" # Google DNS
Check:
- WireGuard handshake:
/interface wireguard peers print - Routing table:
/ip route print - Firewall rules:
/ip firewall filter print - DNS resolution:
/ping cloudflare.com
Cause: Interface name mismatch or no peer configured
Fix:
# List all interfaces and peers
/interface wireguard print
/interface wireguard peers print
# Update script with correct name
:local wgInterface "correct-name-here"
Yes, but requires script modification:
# Force specific endpoint (for testing)
:local testIP "162.159.192.1"
:local testPort 500
# Skip random generation, use test values
/interface wireguard peers set $peerId \
endpoint-address=$testIP \
endpoint-port=$testPort
Yes, create blocklist:
# Add to script after generation
:local blockedIPs [:toarray "162.159.192.5,8.6.112.10"]
:if ([:typeof [:find $blockedIPs $endpointIP]] != "nil") do={
# Skip this IP
:continue
}
The script automatically saves it in the WireGuard peer configuration. View with:
/interface wireguard peers print detail
To export configuration:
/export file=wireguard-config
Yes! Create copies with different interface names:
# Script 1: warp-finder-wgcf.rsc
:local wgInterface "wgcf"
# Script 2: warp-finder-wgcf2.rsc
:local wgInterface "wgcf2"
Schedule separately.
Parse logs programmatically:
# Get last successful endpoint
/log print where message~"SUCCESS"
Export to Syslog:
/system logging action set remote remote=192.168.1.100
/system logging add topics=script action=remote
Email notifications (requires email setup):
/tool e-mail send to="[email protected]" \
subject="WARP Endpoint Updated" \
body="New endpoint: $endpointIP:$endpointPort"
# Disable debug logs
:global DEBUG 0
:local delayTime 1 # Reduce wait time
:local pingCount 1 # Fewer ping packets
:local maxAttempts 10 # Fewer attempts
Warning: Reducing delays may cause false negatives.
:local delayTime 5 # Longer wait for slow connections
:local pingCount 10 # More comprehensive testing
:local maxAttempts 100 # More attempts
The script uses ping tests. Alternatives require modifications:
TCP test (advanced):
# Test HTTPS connectivity instead of ping
/tool fetch url="https://1.1.1.1" keep-result=no
Traceroute (advanced):
# Verify routing path
/tool traceroute 1.1.1.1 count=1
Only standard ping (ICMP) packets to test connectivity. No personal data transmitted.
No. The script never reads or logs private keys.
This is a network management tool. Use responsibly and in compliance with your organization's policies and local laws.
No. The script runs entirely on your router with no external communication except connectivity tests.
| Version | Status |
|---|---|
| 6.x | ❌ Not supported (no WireGuard) |
| 7.0-7.19 | |
| 7.20+ | ✅ Fully supported |
| 7.x latest | ✅ Recommended |
Compatible with all MikroTik devices running RouterOS 7.20+:
- RB series (RB750, RB4011, etc.)
- hAP series
- CCR series
- CRS series with RouterOS
- CHR (Cloud Hosted Router)
- x86 installations
Optimized for Cloudflare WARP, but adaptable for:
- Mullvad VPN
- ProtonVPN
- Custom WireGuard servers
- Any multi-endpoint WireGuard service
-
Read the documentation
- README.md
- Quick Start
- This FAQ
-
Search existing issues
-
Ask the community
-
Report bugs
See CONTRIBUTING.md for detailed guidelines.
Quick start:
- Fork the repository
- Make improvements
- Test thoroughly
- Submit pull request
Yes! See CHANGELOG.md for version history.
Can't find your answer?
Last updated: February 1, 2025