我有一台CentOS 6.5
在远程位置运行的服务器,我通过路由器上的端口转发使用 SSH 访问该服务器。
一切都工作正常,直到今天我发现我无法再从服务器访问互联网。
我仍然可以通过远程 SSH 连接到它,它仍然有静态 IP 地址、网关等,我只是无法使用互联网。
如果我在另一台计算机上使用服务器以太网电缆,则可以正常访问互联网
但如果我尝试 ping 我会立即收到错误
# ping google.com
# ping: unknown host google.com
有没有人有任何建议的步骤来找出原因?
**
文件内容/etc/resolv.conf
:
; generated by /sbin/dhclient-script
search DOMAINNAME.LOCAL domainname.local
nameserver 192.168.2.9
nameserver 192.168.2.16
文件内容/etc/sysconfig/network-scripts/ifcfg-eth1
:
DEVICE="eth1"
BOOTPROTO="static"
HWADDR="34:40:B5:89:85:BE"
IPADDR=192.168.2.45
NETMASK=255.255.255.0
GATEWAY=192.168.2.254
DNS1=192.168.2.9
DNS2=192.168.2.16
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="bde2561c-9882-4e50-9e3a-22e44f6a5005"
的结果nslookup google.com 192.168.2.9
;; connection timed out; trying next origin
;; connection timed out; trying next origin
;; connection timed out; no servers could be reached
的结果nslookup google.com 192.168.2.16
;; connection timed out; trying next origin
;; connection timed out; trying next origin
;; connection timed out; no servers could be reached
的结果nslookup google.com 8.8.8.8
;; connection timed out; trying next origin
;; connection timed out; trying next origin
;; connection timed out; no servers could be reached
的结果nslookup google.com 8.8.4.4
;; connection timed out; trying next origin
;; connection timed out; trying next origin
;; connection timed out; no servers could be reached
的结果netstat -rn
197.81.19.48 0.0.0.0 255.255.255.248 U 0 0 0 eth0
10.254.254.0 0.0.0.0 255.255.255.0 U 0 0 0 as0t0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.95.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 192.168.2.254 0.0.0.0 UG 0 0 0 eth1
答案1
您的主机路由表在服务器上是什么样子的?
netstat -rn
听起来您有基于本地主机的路由问题。 SSH 的端口转发仍然有效,因为它与您的服务器有本地连接。