Невозможно открыть порт с помощью ufw

Мне нужно открыть порт 8081 для моего приложения. Я хочу подключиться к приложению с другого сервера. Проблема Я не могу открыть порт. Я запустил приложение с портом 8081 и ip 0.0.0.0 и 127.0.0.1 , Я включил ufw / отключил ufw, я прочитал руководство https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-20 -04

моя система:

Идентификатор распространителя: Ubuntu D

описание: Ubuntu 20.04 LTS

Выпуск: 20.04

Кодовое имя: focal

Вывод sudo lsof -i -P -n | grep LISTEN :

app 4431 foo 27u IPv4 64011 0t0 TCP *: 8081 (LISTEN)

вывод sudo ufw status

Статус: активно

К действию От - ------ ---- 22 / tcp ALLOW Anywhere
8081 / tcp ALLOW Anywhere
22 РАЗРЕШИТЬ В любом месте
8081 ALLOW Anywhere
22 / tcp (v6) ALLOW Anywhere (v6)
8081 / tcp (v6) ALLOW Anywhere (v6)
22 (v6) РАЗРЕШИТЬ В любом месте (v6)
8081 (v6) ALLOW Anywhere (v6)

Вывод nmap:

Запуск Nmap 7.80 ( https://nmap.org ) в 2020-06-09 21:03 UTC Отчет о сканировании Nmap для myip.bc.googleusercontent.com (myip) Хост работает (задержка 0,00062 с). Не показано: 999 фильтрованных портов ПОРТОВАЯ ГОСУДАРСТВЕННАЯ СЛУЖБА 22 / tcp open ssh

Выполнено Nmap: 1 IP-адрес (1 хост активирован) просканирован за 8,19 секунды

0
задан 10 June 2020 в 00:08
1 ответ

Если вы используете инстанс облачных вычислений Google, ваш инстанс, вероятно, имеет VPC с собственными правилами брандмауэра по умолчанию:

https://cloud.google.com/vpc/docs/firewalls

The default network is pre-populated with firewall rules that allow incoming connections to instances. These rules can be deleted or modified as necessary:

default-allow-internal Allows ingress connections for all protocols and ports among instances in the network. This rule has the second-to-lowest priority of 65534, and it effectively permits incoming connections to VM instances from others in the same network.

default-allow-ssh Allows ingress connections on TCP port 22 from any source to any instance in the network. This rule has a priority of 65534.

default-allow-rdp Allows ingress connections on TCP port 3389 from any source to any instance in the network. This rule has a priority of 65534, and it enables connections to instances running the Microsoft Remote Desktop Protocol (RDP).

default-allow-icmp
Allows ingress ICMP traffic from any source to any instance in the network. This rule has a priority of 65534, and it enables tools such as ping

поэтому правила по умолчанию не включают порт 8081 откуда угодно...

Вы можете создать новое правило брандмауэра, чтобы разрешить вход на 8081 через веб-консоль облачной платформы Google (Сеть VPC -> Брандмауэр ), используя этот документ:

https://cloud.google.com/vpc/docs/using-firewalls#creating_firewall_rules

Это будет выглядеть так

enter image description here

Также

nmap работает немного медленно, поэтому вы можете попробовать подключиться напрямую через telnet или nc:

$ telnet myip.bc.googleusercontent.com 8081
Trying 123.123.123.123...
Connected to myip.bc.googleusercontent.com.
Escape character is '^]'.
^]

или

$ nc -zv myip.bc.googleusercontent.com 8081
Ncat: Version 7.80 ( https://nmap.org/ncat )
Ncat: Connected to 123.123.123.123:1234.
Ncat: 0 bytes sent, 0 bytes received in 0.24 seconds.
0
ответ дан 9 June 2020 в 21:20

Теги

Похожие вопросы