有一个在 Parallels 上运行的 centos 6.3 box
我正在尝试打开端口 80 以便从外部访问
尝试了这篇文章中的 gui 解决方案并且它有效,但我需要从脚本中完成它。
试图这样做:
sudo /sbin/iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
sudo /sbin/iptables-save
sudo /sbin/service iptables restart
Run Code Online (Sandbox Code Playgroud)
这将创建与 GUI 工具完全相同的 iptables 条目,但它不起作用:
$ telnet xx.xxx.xx.xx 80
Trying xx.xxx.xx.xx...
telnet: connect to address xx.xxx.xx.xx: Connection refused
telnet: Unable to connect to remote host
Run Code Online (Sandbox Code Playgroud)
更新:
$ netstat -ntlp
(No info could be read for "-p": geteuid()=500 but you should be root.)
Active …
Run Code Online (Sandbox Code Playgroud)