> For the complete documentation index, see [llms.txt](https://docs.plenit.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.plenit.com/docs-en/productos/servers/how-to/how-to-configure-geoip-to-block-or-allow-countries.md).

# How to Configure GeoIP to Block or Allow Countries on Your Servers

GeoIP lets you decide from which countries traffic to your **public IPs** of your services.

It is an easy way to reduce the attack surface when legitimate traffic should only come from specific regions.

> #### 👍 What you get
>
> Control access to your services by country of origin, for each public IP, with a one-click return to the default state.

### What it is for

* **Security**: block regions from which you only receive attacks.
* **Simplicity**: country-based rules, without maintaining IP lists by hand.
* **Compliance**: apply country restrictions if your client requires it (for example, GDPR or sector-specific requirements).
* **Flexibility**: different policies per server or per network as needed.

### How it works

GeoIP combines two layers:

* **Perimeter layer**, at the edge of the infrastructure: filters traffic by country. This is where the default global policy lives (the list of blocked countries).
* **Your subscription's network layer**: controls the ports and protocols of **Inbound/Outbound** within your network. It does not filter by country.

From GeoIP, for each public IP you choose the **blocked countries**: checked means **Deny** and unchecked means **Allow**. If you allow a country that the global policy blocks, an *allow*exception is created; if you block one that the global policy does not block, a *deny* rule of yours is created.

> #### 🚧 GeoIP does not open ports
>
> GeoIP filters by country at the perimeter layer, but it does not touch ports. If the port or protocol are still closed in your Inbound/Outbound rules, traffic will not pass even if you allow that country.

### Before you begin

* Log in to the Plenit dashboard.
* Have administrative permissions on **Servers**.
* That the network you are going to work on has at least one **public IP**.

### Step 1. Access GeoIP

1. In the dashboard, open **Cloud Services → Servers** and enter your server subscription.
2. In the top tab bar, open **Firewall**.
3. Open the subtab **Geolocation**.

![Access to the Firewall Geolocation tab](https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FIyUPrjXEoQb47yXzQBG8%2Fservidores-howto-geoip-01.png?alt=media\&token=c1e0f0f6-0a86-43e0-ad47-08c449e9719c)

### Step 2. Select the network

At the top, use the **Network selector** to choose where to apply GeoIP. You'll see the public IP table (Public IP) and how many countries each one has blocked (Blocked countries).

> #### 📘 145 entries blocked by default
>
> It is common to see 145 entries blocked initially. Of those 145 entries, 140 are countries and 5 are territories without a permanent population: Antarctica, Bouvet Island, Heard and McDonald Islands, French Southern and Antarctic Lands, and South Georgia and the South Sandwich Islands.

![Network selection and list of public IPs](https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FVYYR9GV8qFqch2mRaQWB%2Fservidores-howto-geoip-02.png?alt=media\&token=380209e5-c423-40b8-9437-1c4202d7fcdf)

### Step 3. Review the public IPs and enter edit mode

In the table you can see each public IP, its number of blocked countries, and the action **Edit**. Click **Edit** on the IP you want to adjust.

![Public IP table with the edit option](https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FlWE3agFLubfGlZUYwEBc%2Fservidores-howto-geoip-03.png?alt=media\&token=5bb4792f-8e0f-4b7b-9560-11be3078f6d2)

### Step 4. Manage the countries

The Edit countries screen opens. On the left, mark entire continents or expand them with + to choose specific countries; you can also search for them with Search country. On the right you can see the list of countries that remain blocked. **Checked = blocked**; **unchecked = allowed**. You have **Save**, **Restore settings** and **Cancel**.

![Country selector to block or allow](https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FzavsJpEJJ9lyvPD2NjWk%2Fservidores-howto-geoip-04.png?alt=media\&token=d559f85f-6dc9-4288-96f5-68be5f2f6344)

### Step 5. Confirm and apply

Press **Save**, review the list of countries that will be blocked or allowed in the Are you sure? notice, and press **Confirm**. The changes are synchronized with the infrastructure: it is not immediate, it takes a few minutes.

![Summary and confirmation of GeoIP changes](https://3894148717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxksPMyYRDCe4qKkhbpcY%2Fuploads%2FRqClwAxzofBT4u9F8ozq%2Fservidores-howto-geoip-05.png?alt=media\&token=ba1b009d-f319-49d6-8259-7aad5a5ce0f3)

### Step 6. Verify the result

Check the counter of **blocked countries** on the edited IP and run access tests if needed. For a quick check from a source in the country you want to validate:

```bash
curl -I http://<PUBLIC-IP>
```

Since the filtering depends on the country of origin, to test a blocked country you need to connect from that country (for example, through a VPN in that region). If you need to start from scratch, use **Restore settings**.

### Practical cases

| Case                             | What you do                                                         |
| -------------------------------- | ------------------------------------------------------------------- |
| Allow only Spain and Portugal    | Mark all countries, uncheck Spain and Portugal, **Save → Confirm**  |
| Allow Canada temporarily         | Uncheck Canada, **Save → Confirm**; when you're done, mark it again |
| You don't know the current state | **Restore settings** and start clean from the global policy         |

### Usage tips

* **Less is more**: block first and open only what is essential.
* **Standardize**: apply the same base policy to several IPs and document the exceptions.
* **Use Restore settings** as a reset when you do not know what rules are applied.
* **Remember the network layer**: if the port or protocol is closed in Inbound/Outbound, they will not get in even if you allow the country.

### If something doesn't fit

| Symptom                                       | Likely cause                                 | What to do                                               |
| --------------------------------------------- | -------------------------------------------- | -------------------------------------------------------- |
| The Confirm button is disabled                | There are no changes to apply                | Make some changes or exit with Cancel                    |
| I allowed a country but it still doesn't work | Propagation is missing or the port is closed | Wait a few minutes and check your Inbound/Outbound rules |
| I blocked too much and lost access            | Policy too restrictive                       | Use **Restore settings**                                 |
| I don't see the Geolocation tab               | The view is not available in your dashboard  | Contact Partner Success so they can enable it            |

### Conclusion

GeoIP gives you a simple security lever: you decide by country who reaches your public IPs, without maintaining address lists by hand and with a reset button when you need it.

The golden rule is to remember that it acts only on the country of origin: you still control ports and protocols in the Inbound/Outbound rules, so GeoIP adds to that layer, it does not replace it.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.plenit.com/docs-en/productos/servers/how-to/how-to-configure-geoip-to-block-or-allow-countries.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
