我正在尝试打开端口,但却完全失败了。
我的工作环境:Ubuntu 16.04.2 LTS
我尝试了以下命令:
sudo ufw enable
sudo ufw allow 500
sudo ufw allow 500/udp
sudo iptables -A INPUT -p udp --dport 500 -j ACCEPT
sudo ufw reload
sudo ufw restart
但当我检查端口是否启用时netstat -ntlp | grep LISTEN
我得到了以下输出:
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 1247/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 1247/named
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1245/sshd
tcp6 0 0 ::1:953 :::* LISTEN 1247/named
tcp6 0 0 :::8080 :::* LISTEN 1465/docker-proxy
tcp6 0 0 ::1:53 :::* LISTEN 1247/named
tcp6 0 0 :::22 :::* LISTEN 1245/sshd
而且我无法到达端口 500,我非常沮丧。
以及sudo ufw status verbose
输出(有点混乱);
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), allow (routed)
New profiles: skip
To Action From
-- ------ ----
22 ALLOW IN Anywhere
23 ALLOW IN Anywhere
8080 ALLOW IN Anywhere
8080/tcp ALLOW IN Anywhere
8080/udp ALLOW IN Anywhere
9010:9030/tcp ALLOW IN Anywhere
9010:9030/udp ALLOW IN Anywhere
500:4500/tcp ALLOW IN Anywhere
500:4500/udp ALLOW IN Anywhere
8 ALLOW IN Anywhere
222 ALLOW IN Anywhere
2222 ALLOW IN Anywhere
9191/udp ALLOW IN Anywhere
9191/tcp ALLOW IN Anywhere
8111 ALLOW IN Anywhere
5432 ALLOW IN Anywhere
22/tcp ALLOW IN Anywhere
80/tcp ALLOW IN Anywhere
443/tcp ALLOW IN Anywhere
Anywhere ALLOW IN 1.2.3.4
151.80.41.166 8111/tcp ALLOW IN Anywhere
22/tcp ALLOW IN 1.2.3.4
80 ALLOW IN Anywhere
443 ALLOW IN Anywhere
500/udp ALLOW IN Anywhere
4500/udp ALLOW IN Anywhere
22 (v6) ALLOW IN Anywhere (v6)
23 (v6) ALLOW IN Anywhere (v6)
8080 (v6) ALLOW IN Anywhere (v6)
8080/tcp (v6) ALLOW IN Anywhere (v6)
8080/udp (v6) ALLOW IN Anywhere (v6)
9010:9030/tcp (v6) ALLOW IN Anywhere (v6)
9010:9030/udp (v6) ALLOW IN Anywhere (v6)
500:4500/tcp (v6) ALLOW IN Anywhere (v6)
500:4500/udp (v6) ALLOW IN Anywhere (v6)
8 (v6) ALLOW IN Anywhere (v6)
222 (v6) ALLOW IN Anywhere (v6)
2222 (v6) ALLOW IN Anywhere (v6)
9191/udp (v6) ALLOW IN Anywhere (v6)
9191/tcp (v6) ALLOW IN Anywhere (v6)
8111 (v6) ALLOW IN Anywhere (v6)
5432 (v6) ALLOW IN Anywhere (v6)
22/tcp (v6) ALLOW IN Anywhere (v6)
80/tcp (v6) ALLOW IN Anywhere (v6)
443/tcp (v6) ALLOW IN Anywhere (v6)
80 (v6) ALLOW IN Anywhere (v6)
443 (v6) ALLOW IN Anywhere (v6)
500/udp (v6) ALLOW IN Anywhere (v6)
4500/udp (v6) ALLOW IN Anywhere (v6)