我有一个 4G 路由器连接到 Ubuntu 18.04 服务器的 NIC。我需要能够使用路由器的公共 IP 来访问服务器上托管的网页。我已正确配置了路由器上的端口转发(通过连接非 Ubuntu 设备并成功进行端口转发来确认这一点),但仍然失败。服务器上的默认路由配置为路由器的 IP。使用ufw
我已经完全放弃了防火墙限制,以至于任何连接都应该能够建立。
在 /etc/default/uwf 中:
# /etc/default/ufw #
# Set to yes to apply rules to support IPv6 (no means only IPv6 on loopback
# accepted). You will need to 'disable' and then 'enable' the firewall for
# the changes to take affect.
IPV6=yes
# Set the default input policy to ACCEPT, DROP, or REJECT. Please note that if
# you change this you will most likely want to adjust your rules.
DEFAULT_INPUT_POLICY="ACCEPT"
# Set the default output policy to ACCEPT, DROP, or REJECT. Please note that if
# you change this you will most likely want to adjust your rules.
DEFAULT_OUTPUT_POLICY="ACCEPT"
# Set the default forward policy to ACCEPT, DROP or REJECT. Please note that
# if you change this you will most likely want to adjust your rules
DEFAULT_FORWARD_POLICY="ACCEPT"
# Set the default application policy to ACCEPT, DROP, REJECT or SKIP. Please
# note that setting this to ACCEPT may be a security risk. See 'man ufw' for
# details
DEFAULT_APPLICATION_POLICY="SKIP"
# By default, ufw only touches its own chains. Set this to 'yes' to have ufw
# manage the built-in chains too. Warning: setting this to 'yes' will break
# non-ufw managed firewall rules
MANAGE_BUILTINS=no
root@server:/etc/ufw# ufw status verbose
Status: active
Logging: on (low)
Default: allow (incoming), allow (outgoing), allow (routed)
New profiles: skip
To Action From
-- ------ ----
Anywhere ALLOW IN 10.20.0.0/24
80 ALLOW IN Anywhere
80/tcp ALLOW IN Anywhere
22/tcp ALLOW IN Anywhere
22 ALLOW IN Anywhere
8088 ALLOW IN Anywhere
80 (v6) ALLOW IN Anywhere (v6)
80/tcp (v6) ALLOW IN Anywhere (v6)
22/tcp (v6) ALLOW IN Anywhere (v6)
22 (v6) ALLOW IN Anywhere (v6)
8088 (v6) ALLOW IN Anywhere (v6)
关于允许端口转发的更改有什么建议吗?