# Setting Up Port Forwarding for IPSEC IKE Tunnel

<details id="bkmrk-introduction-port-fo"><summary>Introduction</summary>

- Port forwarding, also known as tunnelling, is a network technology procedure that enables external devices to access services on a private network. This is achieved by rerouting communication requests from one address and port number combination to another while packets traverse a network gateway.
- It is extensively used in scenarios where certain applications or services need to be accessible from the internet, including online gaming, torrent downloads, and hosting web servers. These applications typically require direct communication with devices on your private network, which isn’t possible due to NAT (Network Address Translation) mechanisms used by most routers.
- While port forwarding can grant outside access and improve connectivity, it also presents a potential risk as it exposes your internal network to the internet. As such, it’s crucial to exercise due caution by only forwarding necessary ports and implementing robust security measures such as using strong, complex passwords and up-to-date firewall settings.

</details><details id="bkmrk-method-step-1%3A-acces"><summary>Method</summary>

**<span style="font-size: 13.5pt; mso-ligatures: none; mso-fareast-language: EN-GB;">Step 1: Access MikroTik Router</span>**

1. <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Open Winbox or your web browser and connect to your MikroTik router.</span>
2. <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Log in using your credentials.</span>

**<span style="font-size: 13.5pt; mso-ligatures: none; mso-fareast-language: EN-GB;">Step 2: Configure Port Forwarding</span>**

1. **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Go to IP &gt; Firewall &gt; NAT</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">.</span>
2. <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Click on the **+** to add a new rule.</span>

**<span style="font-size: 12.0pt; mso-ligatures: none; mso-fareast-language: EN-GB;">1. Port Forwarding for UDP Port 500 (IKE)</span>**

- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">General Tab</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Chain</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">dstnat</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Protocol</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">udp</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Dst. Port</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">500 (this may change, request from the client what is needed. Also ensure that it does not interfere with any existing ports configured)</span>

- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Action Tab</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Action</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">dst-nat</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">To Addresses</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: Internal IP address (e.g., 192.168.1.2)</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">To Ports</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">500 (this may change, request from the client what is needed. Also ensure that it does not interfere with any existing ports configured)</span>


**<span style="font-size: 12.0pt; mso-ligatures: none; mso-fareast-language: EN-GB;">2. Port Forwarding for UDP Port 4500 (NAT-T)</span>**

- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">General Tab</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Chain</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">dstnat</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Protocol</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">udp</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Dst. Port</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">4500 (this may change, request from the client what is needed. Also ensure that it does not interfere with any existing ports configured)</span>

- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Action Tab</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Action</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">dst-nat</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">To Addresses</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: Internal IP address (e.g., 192.168.1.2)</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">To Ports</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">4500 (this may change, request from the client what is needed. Also ensure that it does not interfere with any existing ports configured)</span>


**<span style="font-size: 13.5pt; mso-ligatures: none; mso-fareast-language: EN-GB;">Step 3: Configure Firewall Rules</span>**

1. **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Go to IP &gt; Firewall &gt; Filter Rules</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">.</span>
2. <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Click on the **+** to add new rules.</span>

**<span style="font-size: 12.0pt; mso-ligatures: none; mso-fareast-language: EN-GB;">1. Allow UDP Port 500 (IKE)</span>**

- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">General Tab</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Chain</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">forward</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Protocol</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">udp</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Dst. Port</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">500 (this may change, request from the client what is needed. Also ensure that it does not interfere with any existing ports configured)</span>

- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Action Tab</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Action</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">accept</span>


**<span style="font-size: 12.0pt; mso-ligatures: none; mso-fareast-language: EN-GB;">2. Allow UDP Port 4500 (NAT-T)</span>**

- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">General Tab</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Chain</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">forward</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Protocol</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">udp</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Dst. Port</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">4500 (this may change, request from the client what is needed. Also ensure that it does not interfere with any existing ports configured)</span>

- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Action Tab</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Action</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">: </span><span style="font-size: 10.0pt; font-family: 'Courier New'; mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">accept</span>


**<span style="font-size: 13.5pt; mso-ligatures: none; mso-fareast-language: EN-GB;">Step 4: Sort the Filter Rules</span>**

- <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Drag and drop the filter rules you have created in **Step 3** so that they are above any existing 'drop rules'.</span>

**<span style="font-size: 13.5pt; mso-ligatures: none; mso-fareast-language: EN-GB;">Step 5: Ensure IP Forwarding is Enabled</span>**

1. **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Go to IP &gt; Settings</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">.</span>
2. <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Make sure **IP Forwarding** is enabled.</span>

**<span style="font-size: 13.5pt; mso-ligatures: none; mso-fareast-language: EN-GB;">Step 6: Verify Configuration</span>**

1. **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Check the NAT Rules</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>

- <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Ensure the NAT rules are correctly set up and active.</span>
- <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Go to **IP &gt; Firewall &gt; NAT** and verify that the new rules are listed and active.</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Check the Firewall Rules</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>

- <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Ensure the firewall rules are correctly set up and active.</span>
- <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Go to **IP &gt; Firewall &gt; Filter Rules** and verify that the new rules are listed and active.</span>
- **<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Test the VPN Connection</span>**<span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">:</span>

- <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Attempt to establish the VPN connection from the internal router to Azure.</span>
- <span style="mso-fareast-font-family: 'Times New Roman'; mso-ligatures: none; mso-fareast-language: EN-GB;">Verify the connection by checking the VPN status on the internal router.</span>

</details>