iptables scene one (middle)

One solution to this machine can not access the machine
1. Problem phenomenon
[root@localhost ~]# telnet 127.0.0.1 22
Trying 127.0.0.1...
No response
2. Solution
[root@localhost ~]# iptables -I INPUT -i lo -j ACCEPT
[root@localhost ~]# telnet 127.0.0.1 22
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.6.1
 
Second, the machine cannot access other hosts
1. Problem phenomenon
[root@localhost ~]# curl http://www.imooc.com
No response
 
2. Solution
[root@localhost ~]# iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
[root@localhost ~]# curl -I http://www.imooc.com
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 19 Aug 2017 01:11:30 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
Vary: Accept-Encoding
Set-Cookie: PHPSESSID=kri810qlngk8a1sn261mrmun12; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache

 

Set-Cookie: imooc_uuid=1481b96a-a1dc-4337-bdde-57c2e74c8b40; expires=Sun, 19-Aug-2018 01:11:29 GMT; path=/; domain=.imooc.com

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326171195&siteId=291194637