# Enable IP Forwarding

IP forwarding, also known as IP routing, is a process that allows a network device (like a router or a computer configured to act as a router) to pass incoming IP packets from one network interface to another. This is a fundamental function in networked environments, enabling communication between different networks and ensuring that data packets reach their intended destinations.

By default, IP forwarding is enabled. If you want to use your instance as a next hop for a route, this instance needs to forward packets whose sources don't match one of the default IP addresses or ranges. To forward packets with arbitrary source addresses, you must enable IP forwarding.

## Procedures

1. Check **Enable IP forwarding** when you create an instance, or check **Enable IP Forwarding** in **Actions**.
2. Manually enable IP forwarding within the instancet operating system.\
   Below are the steps for enabling IP forwarding on common OS types: Linux and Windows.

{% tabs %}
{% tab title="Linux" %}
**Temporary Enablement**

To temporarily enable IP forwarding until the next reboot, you can use the following command.

* For IPv4

  ```sh
  sudo sysctl -w net.ipv4.ip_forward=1
  ```
* For IPv6

  ```sh
  sudo sysctl -w net.ipv6.conf.all.forwarding=1
  ```

**Permanent Enablement**

1. To make the change permanent, edit the `/etc/sysctl.conf` file.

   ```sh
   sudo nano /etc/sysctl.conf
   ```
2. Add or uncomment the following line.
   * For IPv4

     ```sh
     net.ipv4.ip_forward=1
     ```
   * For IPv6

     ```sh
     net.ipv6.conf.all.forwarding=1
     ```
3. Save the file and apply the changes.

   ```sh
   sudo sysctl -p
   ```

{% endtab %}

{% tab title="Windows" %}
**Enable via Command Prompt**

1. Open Command Prompt as an administrator.
2. Enter the following command.
   * For IPv4

     ```sh
     netsh interface ipv4 set global forwarding=enabled
     ```
   * For IPv6

     ```sh
     netsh interface ipv6 set global forwarding=enabled
     ```

**Enable via Registry Editor**

Open the Registry Editor by typing `regedit` in the Run dialog (Win + R).

* For IPv4
  1. Navigate to the following key.

     ```plaintext
     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
     ```
  2. Find the `IPEnableRouter` entry. If it does not exist, create a new DWORD (32-bit) value with that name.
  3. Set the value of `IPEnableRouter` to `1`.
  4. Restart your computer for the changes to take effect.
* For IPv6
  1. Navigate to the following key.

     ```plaintext
     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters
     ```
  2. Find the `DisabledComponents` entry. If it does not exist, create a new DWORD (32-bit) value with that name.
  3. Set the value of `DisabledComponents` to `0`.
  4. Restart your computer for the changes to take effect.
     {% endtab %}
     {% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.console.zenlayer.com/welcome/elastic-compute/get-started/manage-networking/enable-ip-forwarding.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
