我在 HP Proliant DL360 上全新安装了 centos 6.6。我已经安装了 mysql、php、apache
我无法通过 putty 从我的 IP xxxx 登录,但在我的局域网 192.168.0.5 内使用时,我可以正常连接
问:为什么我无法通过局域网外的 IP 连接 ssh 登录?
端口 22 上的当前 tcp netstat 读数为:
[root@localhost etc]# netstat -tulpn | grep :22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 7646/sshd
tcp 0 0 :::22 :::* LISTEN 7646/sshd
当前iptables设置如下:
[root@localhost etc]# iptables --line -vnL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 20825 14M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
3 45 2700 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
4 3 156 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp spt:80 state NEW,ESTABLISHED
6 1302 67684 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 state NEW,ESTABLISHED
7 2151 276K REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
服务器ip设置:
[root@localhost etc]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:1e:0b:5e:59:22 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.5/24 brd 192.168.0.255 scope global eth0
inet6 fe80::21e:bff:fe5e:5922/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 00:1e:0b:5e:59:1a brd ff:ff:ff:ff:ff:ff
答案1
您只有一个与机器关联的私有 IP 地址,因此您需要配置具有您想要连接的公共 IP 地址的任何设备,以将 SSH 连接传递到该服务器。