最近遇到一個郁悶的問題。好幾天都沒解決,求助,謝謝大家。
打算開放一個端口15900。可是無論怎么設置防火牆,或者干脆關閉防火牆。就是不能被外部機器訪問(在同一內網網段機器)。
本機訪問沒有問題(127.0.0.1)。防火牆配置應該也沒有問題。
iptables status:
復制內容到剪貼板
代碼:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ftp
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:15900
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
輸入lsof -i 顯示如下信息。
復制內容到剪貼板
代碼:
ntpd 1640 ntp 21u IPv4 13492 0t0 UDP 192.168.2.111:ntp
master 1720 root 12u IPv4 13709 0t0 TCP localhost.localdomain:smtp (LISTEN)
httpd 1730 root 4u IPv6 13843 0t0 TCP *:http (LISTEN)
httpd 1737 apache 4u IPv6 13843 0t0 TCP *:http (LISTEN)
httpd 1738 apache 4u IPv6 13843 0t0 TCP *:http (LISTEN)
httpd 1739 apache 4u IPv6 13843 0t0 TCP *:http (LISTEN)
httpd 1740 apache 4u IPv6 13843 0t0 TCP *:http (LISTEN)
httpd 1741 apache 4u IPv6 13843 0t0 TCP *:http (LISTEN)
httpd 1742 apache 4u IPv6 13843 0t0 TCP *:http (LISTEN)
httpd 1743 apache 4u IPv6 13843 0t0 TCP *:http (LISTEN)
httpd 1744 apache 4u IPv6 13843 0t0 TCP *:http (LISTEN)
Xvnc 1776 root 4u IPv4 14282 0t0 TCP localhost.localdomain:15900 (LISTEN)
clock-app 2111 root 21u IPv4 26309 0t0 TCP 192.168.2.111:48606->65.113.31.147:http (CLOSE_WAIT)
sshd 2281 root 3r IPv4 20572 0t0 TCP 192.168.2.111:ssh->192.168.2.61:57678 (ESTABLISHED)
192.168.2.111是當機IP
可以看出來,80端口,21,22都沒問題。但就是自己后來添加上來的端口不能訪問。是沒有與服務綁定么?
關鍵這句“localhost.localdomain:15900 (LISTEN) ”
防火牆關閉,SElinux關閉還是不能解決問題
解決!VNC配置問題。居然沒看清楚。郁悶。。。
復制內容到剪貼板
代碼:
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -localhost"
問題出在localhost,刪掉-nolisten tcp -localhost 解決