某日在通过指定端口访问服务器时发现本地电脑连接不上,故想到是防火墙端口没开导无法访问,关于如何开启Ubuntu防火墙端口如下:
1.查看当前防火墙状态和开启的端口:(active表示防火墙开启)
root@vultr:~# ufw status
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
2.开启指定端口,例如开启80端口
root@vultr:~# ufw allow 80
Rule added
Rule added (v6)
3.重新载入防火墙配置
root@vultr:~# ufw reload
Firewall reloaded
4.查看防火墙已启动端口,可看到80端口已开启
root@vultr:~# ufw status
Status: active
To Action From
— —— —-
22 ALLOW Anywhere
80 ALLOW Anywhere