ITeye博客

iptables场景一(中)

cakin24 · 2017-10-06 06:46 · Linux · 安全 · 操作系统 · Markdown

一 解决本机无法访问本机

1、问题现象

[root@localhost ~]# telnet 127.0.0.1 22

Trying 127.0.0.1...

无响应

2、解决方法

[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

 

二 解决本机无法访问其他主机

1、问题现象

[root@localhost ~]# curl http://www.imooc.com

无响应

 

2、解决方法

[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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。