加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 通过在iptables(Ubuntu)中添加规则来打开端口443

发布时间:2020-12-14 01:28:21 所属栏目:Linux 来源:网络整理
导读:我是ubuntu新手并使用ubuntu服务器12.04. 当我运行nmap localhost时,我得到以下输出: Not shown: 997 closed portsPORT STATE SERVICE22/tcp open ssh80/tcp open http3306/tcp open mysql 这意味着端口443(https)已关闭.我想打开它. 所以我做了以下事情:
我是ubuntu新手并使用ubuntu服务器12.04.
当我运行nmap localhost时,我得到以下输出:

Not shown: 997 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
3306/tcp open  mysql

这意味着端口443(https)已关闭.我想打开它.
所以我做了以下事情:

我跑了命令

sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT

并保持更改我使用sudo sh -c“iptables-save> /etc/iptables.rules”保存文件

然后我将以下行添加到etc / network / interfaces:

pre-up iptables-restore < /etc/iptables.rules
post-down iptables-save > /etc/iptables.rules

重新启动我的系统后,我运行了sudo iptables -L和线路

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https

是可见的.

但是现在当我运行nmap localhost时,我仍然没有看到443是开放的.

请帮忙!

解决方法

我打赌你没有在主机上听443端口.试试这个:在一个终端运行sudo nc -lk 443,然后运行你的nmap localhost.这可能与iptables防火墙规则无关.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读