RouterOS scripting: How to get Wireguard peer endpoint address on MikroTik
We assume that the peer you want to find info about has comment=peer1.mydomain.com. Use
Use
get_wireguard_peer_endpoint.rsc
interface wireguard peers get number=[find comment=peer1.mydomain.com] value-name=endpoint-addressor use :put [...] to print the value:
print_wireguard_endpoint.rsc
:put [interface wireguard peers get number=[find comment=peer1.mydomain.com] value-name=endpoint-address]Example
example_output.txt
[admin@CoreSwitch01] > :put [interface wireguard peers get number=[find comment=peer1.mydomain.com] value-name=endpoint-address]
12.245.102.141If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow