> For the complete documentation index, see [llms.txt](https://learn.netmaker.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.netmaker.io/help-articles/site-to-site-vpn-with-mikrotik-router-using-wg-plugin.md).

# Site-to-Site VPN with Mikrotik router using wg plugin

## Site-to-Site VPN with Mikrotik router using wg plugin

#### Network Topology

<figure><img src="https://downloads.intercomcdn.com/i/o/1187349601/9a42e1a4c15f06529a737e74/image.png?expires=1769018400&#x26;signature=3d600363ce765867d3c16c8d47fd21608a895333fae4c295e944ee1d274f7e5b&#x26;req=dSEvEcp6lIdfWPMW1HO4zVCn4to6A1Vv%2BVJ7VIyS0WmLBpES6Ywlo4mbvzOU%0A1zVdy82G3WHM70yXBZg%3D%0A" alt=""><figcaption></figcaption></figure>

### Configuration Steps

{% stepper %}
{% step %}

### Router 1 (Site A) configuration

#### Step 1 — Access Mikrotik Router

Log in to the Mikrotik router.

#### Step 2 — Create WireGuard Interface

* Go to Interfaces > Add New > WireGuard.
* Configure the following: Name, Listen Port. Private and public keys will be generated automatically.

![](https://downloads.intercomcdn.com/i/o/1187354460/be82fd89f0a70ee52c64a14a/image.png?expires=1769148000\&signature=dbf7a1036ec243cc0d44caaa8f78fdc7ab70ac53e9e7121345312ad916014bc6\&req=dSEvEcp7mYVZWfMW3Hu4gaicgp6%2Fm49VmQ0BYlkovD96A7waqm2anW4a3dao%0AzA%3D%3D%0A)

Click Apply and OK.
{% endstep %}

{% step %}

### Router 1 — Step 3: Set IP Address for WireGuard Interface

* Navigate to IP > Addresses.
* Add a new IP address for the WireGuard interface (wg-client).

![](https://downloads.intercomcdn.com/i/o/1187359102/6616cb1182b643e7490d3066/image.png?expires=1769018400\&signature=8424341bcce411dc01cf67974a39fd5b9d6642c3a15af0e9aedbd34c300e7779\&req=dSEvEcp7lIBfW%2FMW1HO4zQsYxQnKUkZ6OjB5%2Bpw3RUyxBbckL5aA%2FikVSx1F%0AT7qF%0A)
{% endstep %}

{% step %}

### Router 1 — Step 4: Add WireGuard Peer

* Go to WireGuard > Peers.
* Add a new peer for Site A.

![](https://downloads.intercomcdn.com/i/o/1187360338/9ab4ec053cf517c17e3c20e5/image.png?expires=1769018400\&signature=3016df41199a3d10a4d43189f141a8af99f95f9e2dfcd232146c0e8cb6fde644\&req=dSEvEcp4nYJcUfMW1HO4zTQQkGx2fEBZtq9p2k9a9md9xXHOxtIuDvT6hn9r%0AKufg%0A)
{% endstep %}

{% step %}

### Router 1 — Step 5: Configure Routes

* Go to IP > Routes.
* Add a route to Site B’s local network through the WireGuard interface.

![](https://downloads.intercomcdn.com/i/o/1187363397/c0a1c4a6f2d9e2d3a50cffe0/image.png?expires=1769018400\&signature=dacf4c375e08e7e5f2057dc706d7da9092dbbe961ff90ec139cabe0335ef43f3\&req=dSEvEcp4noJWXvMW1HO4zWiy8HxxLQ8mI%2BfbFE1bsTwf3HcAti6LRcnU0B7g%0AQg5a%0A)
{% endstep %}

{% step %}

### Router 1 — Step 6: Add a NAT Rule

* Navigate to IP > Firewall > NAT tab.
* Add a new NAT rule as required.

![](https://downloads.intercomcdn.com/i/o/1187369523/e28836bf05dee483a271bfe3/image.png?expires=1769018400\&signature=467035ce772bcd564933b0837fdcd4d4058c87999d2c00e1c3f3e8b1c2d430f3\&req=dSEvEcp4lIRdWvMW1HO4zQTNWX%2Bq5ysptVf2NNuWQcicRz%2BzQZMxJ7uG18Gv%0AbL7b%0A)

![](https://downloads.intercomcdn.com/i/o/1187369937/337d4d60179a910e4f2f38fb/image.png?expires=1769148000\&signature=beb2c2f6a2a23d3af0296502ecf76e37bc6e1b234890204314a52c951223a0db\&req=dSEvEcp4lIhcXvMW3Hu4gWCL383BmBDkxHMb%2F79wuVkKgJ2l1IS5dyz41xCu%0AiQ%3D%3D%0A)
{% endstep %}

{% step %}

### Router 2 (Site B) configuration

#### Step 1 — Access Mikrotik Router

Log in to the Mikrotik router.
{% endstep %}

{% step %}

### Router 2 — Step 2: Create WireGuard Interface

* Go to Interfaces > Add New > WireGuard.
* Configure Name, Listen Port. Private and public keys will be generated automatically.

![](https://downloads.intercomcdn.com/i/o/1187372547/a45193b5d94df6492f8078aa/image.png?expires=1769018400\&signature=13403500426d2ecc707b666f7e3016a052d836b651c20a777fd6305fd84f9f87\&req=dSEvEcp5n4RbXvMW1HO4zc%2BYdPR7K29Aiv6x324OTVt0Uve2BZej5LWNg43w%0AHXNM%0A)

Click Apply and OK.
{% endstep %}

{% step %}

### Router 2 — Step 3: Set IP Address for WireGuard Interface

* Navigate to IP > Addresses.
* Add a new IP address for the WireGuard interface (wg-plugin).

![](https://downloads.intercomcdn.com/i/o/1187373896/6f6beb718f8651f816e2e077/image.png?expires=1769018400\&signature=b5f56ee9db66b05f7b9159c04ca33f2d437e84e7d15222166cded0a374d8b304\&req=dSEvEcp5nolWX%2FMW1HO4zco0JcQmiLIsRbS%2FJbdgqP2IEYV4%2FHBbS9CgzgDp%0AD%2BP0%0A)
{% endstep %}

{% step %}

### Router 2 — Step 4: Add WireGuard Peer

* Go to WireGuard > Peers.
* Add a new peer for Site B which is Site A using its public key.

![](https://downloads.intercomcdn.com/i/o/1187384828/81617603ad932f0e14db5fc1/image.png?expires=1769018400\&signature=739dfa3ebfae7ed9feb63ee62ba247845cf2e8769465e5d71e1f28cada1e9f1e\&req=dSEvEcp2mYldUfMW1HO4zVQSuaTqoFPV%2BzjaeLiX7buwGJoJJM%2BScsWjSioX%0AGXIJ%0A)
{% endstep %}

{% step %}

### Router 2 — Step 5: Configure Routes

* Go to IP > Routes.
* Add a route to Site A’s local network through the WireGuard interface.

![](https://downloads.intercomcdn.com/i/o/1187385702/6580303fc069a9929b68ffdf/image.png?expires=1769018400\&signature=52d8f074f21481541b5f568164caa06e9db0a55b85859c047fd4c31f607368fa\&req=dSEvEcp2mIZfW%2FMW1HO4zbkuMSyuN34C%2BcyJ9c0UeoRI1rRJPlwvNZdTCgC3%0ALyyk%0A)
{% endstep %}

{% step %}

### Router 2 — Step 6: Add a NAT Rule

* Navigate to IP > Firewall > NAT tab.
* Add a new NAT rule as required.

![](https://downloads.intercomcdn.com/i/o/1187386765/d1fcb504f2cfddb694d1ddb4/image.png?expires=1769018400\&signature=3c9f8daa67e51db22c13d624f505b96ccd73b3dd8a88a12d2eee679db9605223\&req=dSEvEcp2m4ZZXPMW1HO4zUiDwvjkQDTwnsIFH8W2YSnmUKRFaIsCysojEf6X%0AWqZH%0A)
{% endstep %}
{% endstepper %}

### Ping test

<details>

<summary>Ping from Router A to Router B VPC</summary>

![](https://downloads.intercomcdn.com/i/o/1187387798/2928832cad1206b0d9fb1b5f/image.png?expires=1769018400\&signature=78da5d2e60fe652a7ee5393358d18edee9c927a920f2b3920453425349f5b1a7\&req=dSEvEcp2moZWUfMW1HO4zeO4U3XUoZ3IhQ%2F1SC%2FZAMs6hdrhhS%2FBPD4dV%2B8r%0A4s4FKk%2Fi9lAvDv4VnVg%3D%0A)

![](https://downloads.intercomcdn.com/i/o/1187388616/2cabb8e9ed2460950b14070a/image.png?expires=1769018400\&signature=1abb9c4cac14e719b066535ef950140dc0a8f763949f5ba4776af67e79c78563\&req=dSEvEcp2lYdeX%2FMW1HO4zVfNTxTJqRd2nCb18QT2mTqkw1u32c0QD0UpDja7%0AR7dcyWaBcmGC%2BUUFjUo%3D%0A)

</details>

<details>

<summary>Ping from Router B to Router A VPC</summary>

![](https://downloads.intercomcdn.com/i/o/1187389338/e610fe443652231bb57ac756/image.png?expires=1769018400\&signature=de001e3a1809994cb8ec5ceb5a999a8426024e5a30737caaa3ffdc4449112636\&req=dSEvEcp2lIJcUfMW1HO4zc%2B12nD9Ff7Ww0F9v1AAaz4WLhs0AmZORnWlr2wP%0Almfx8aeiEnoywttikDw%3D%0A)

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.netmaker.io/help-articles/site-to-site-vpn-with-mikrotik-router-using-wg-plugin.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
