Перейти к основному содержимому

Configure port-forwarding

If you are self-hosting at home and without a VPN, you will probably want to forward ports on your home router ("Internet box") if you want your server to be reachable from outside your local network. The sketch below tries to briefly summarize the role and necessity of port forwarding when setting up a server at home.

Illustration of the importance of port-forwarding
Illustration of the importance of port-forwarding

0. Диагностировать открытые порты

The diagnosis tool can be used to verify that all necessary ports are exposed to the Internet.

1. Получите доступ к интерфейсу администрирования вашего маршрутизатора

Интерфейс администратора вашего маршрутизатора обычно доступен через http://192.168.0.1 или http://192.168.1.1. Затем вам, вероятно, потребуется ввести логин и пароль к панели роутера, предоставленных вашим провайдером. (P.S. возможно данные указаны на задней стороне роутера)

2. Найдите локальный IP-адрес вашего сервера

Identify the local IP of your server using one of the method listed on the corresponding page.

Локальный IP-адрес обычно выглядит как 192.168.xx.yy или 10.0.xx.yy

Локальный IP-адрес должен быть статичным, чтобы переадресация портов, которую вы собираетесь настроить на следующем шаге, всегда достигала вашего сервера. Вы должны зайти в свой маршрутизатор и убедиться, что локальный IP-адрес вашего сервера является статическим, а не динамическим.

3. Переадресация портов

In your router admin interface, look for something like "router configuration" or "port forwarding". The naming differs among the various kinds of router models.

Открытие перечисленных ниже портов необходимо для работы различных сервисов, доступных в YunoHost. Для каждого из них необходима переадресация "TCP". Некоторые интерфейсы относятся к "внешним" и "внутренним" портам: в нашем случае это одно и то же.

  • Web: 80 (HTTP), 443 (HTTPS)
  • SSH: 22
  • Email: 25, 587 (SMTP), 993 (IMAP)

Если вы используете и модем, и маршрутизатор, то вам необходимо выполнить следующее:

  1. first on the modem (the box closest to the internet) create rules to forward the above ports to your router;
  2. then on the router (the box between the modem and your devices) create rules to forward the above ports to the static IP address for your server.
warning

Many internet service providers (ISPs) block outgoing traffic on port 25 by default, to fight spam. Port 25 is however necessary if you want your server to be able to send email. In other extreme cases, some ISPs may not even allow you to use port 80/443 (web) freely... Depending on the ISP, it might be possible to open them in the admin interface... Check this page for more info.