每次我尝试使用 SSH 连接到我的盒子时,它都无法连接

每次我尝试使用 SSH 连接到我的盒子时,它都无法连接

从任何其他 PC 通过 SSH 连接到我的 Ubuntu 11.10 都失败了。

我的网络设置:

Telenet ISP(比利时)> 光纤电缆 < 在此处输入图片描述> RJ45 电缆直通 > 至 Ubuntu PC

甚至 SSH 也在运行:

在此处输入图片描述

其他电脑:不断重试

$ ping 192.168.0.128
PING 192.168.0.128 (192.168.0.128) 56(84) bytes of data.
From 192.168.0.226 icmp_seq=1 Destination Host Unreachable
From 192.168.0.226 icmp_seq=2 Destination Host Unreachable
From 192.168.0.226 icmp_seq=3 Destination Host Unreachable
From 192.168.0.226 icmp_seq=4 Destination Host Unreachable
$ sudo service iptables stop
Stopping iptables (via systemctl):                         [  OK  ]
$ ssh [email protected]
ssh: connect to host 192.168.0.128 port 22: No route to host
$ ssh [email protected]
ssh: connect to host 192.168.0.128 port 22: No route to host
$ ssh [email protected]
ssh: connect to host 192.168.0.128 port 22: No route to host
$ ssh [email protected]
ssh: connect to host 192.168.0.128 port 22: No route to host
$ ssh [email protected]
Connection closed by 192.168.0.128
$ ssh [email protected]
[email protected]'s password: 
Connection closed by UNKNOWN
$ ssh [email protected]
ssh: connect to host 192.168.0.128 port 22: No route to host
$ ssh [email protected]
ssh: connect to host 192.168.0.128 port 22: No route to host

跟进:

-- checked cable
   -- using cable tester and other detectors 
   -- no problem found in cable 
   -- used random 10 cables

-- adapter is not broken 
   -- checked it using circuit tester by opening the system 
      (card is new so its not network adapter card problem)
   -- leds are OK showing

-- used LiveCD and did same ping test was having same problem

-- disabled ipv6 100% to make sure its not the cause

-- disabled iptables 100% so its also not the issue

-- some more info

$ nmap 192.168.0.128

Starting Nmap 5.50 ( http://nmap.org ) at 2012-06-08 19:11 CEST
Nmap scan report for 192.168.0.128
Host is up (0.00045s latency).
All 1000 scanned ports on 192.168.0.128 are closed (842) or filtered (158)

Nmap done: 1 IP address (1 host up) scanned in 6.86 seconds   

ubuntu@ubuntu:~$ netstat -aunt | head
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      1 192.168.0.128:58616     74.125.132.99:80        FIN_WAIT1  
tcp        0      0 192.168.0.128:56749     199.7.57.72:80          ESTABLISHED
tcp        0      1 192.168.0.128:58614     74.125.132.99:80        FIN_WAIT1  
tcp        0      0 192.168.0.128:49916     173.194.65.113:443      ESTABLISHED
tcp        0      1 192.168.0.128:45699     64.34.119.101:80        SYN_SENT   
tcp        0      0 192.168.0.128:48404     64.34.119.12:80         ESTABLISHED
tcp        0      0 192.168.0.128:54161     67.201.31.70:80         TIME_WAIT



$ sudo killall dnsmasq
  -- did not solved the problem --
  -- like many other Q/A was suggesting this same ---

$ iptables --list
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination    


$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0


$ ssh -vvv [email protected]
OpenSSH_5.6p1, OpenSSL 1.0.0j-fips 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.0.128 [192.168.0.128] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file /home/sun/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/sun/.ssh/id_rsa type 1
debug1: identity file /home/sun/.ssh/id_rsa-cert type -1
debug1: identity file /home/sun/.ssh/id_dsa type -1
debug1: identity file /home/sun/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p1 Debian-7ubuntu1
debug1: match: OpenSSH_5.8p1 Debian-7ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 118/256
debug2: bits set: 539/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: host 192.168.0.128 filename /home/sun/.ssh/known_hosts
debug3: check_host_in_hostfile: host 192.168.0.128 filename /home/sun/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 139
debug1: Host '192.168.0.128' is known and matches the RSA host key.
debug1: Found key in /home/sun/.ssh/known_hosts:139
debug2: bits set: 544/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/sun/.ssh/id_rsa (0x213db960)
debug2: key: /home/sun/.ssh/id_dsa ((nil))
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/sun/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/sun/.ssh/id_dsa
debug3: no such identity: /home/sun/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
[email protected]'s password: 
debug3: packet_send2: adding 64 (len 60 padlen 4 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
Authenticated to 192.168.0.128 ([192.168.0.128]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug3: Ignored env ORBIT_SOCKETDIR
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env HOSTNAME
debug3: Ignored env GIO_LAUNCHED_DESKTOP_FILE_PID
debug3: Ignored env IMSETTINGS_INTEGRATE_DESKTOP
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env TERM
debug3: Ignored env HARDWARE_PLATFORM
debug3: Ignored env SHELL
debug3: Ignored env DESKTOP_STARTUP_ID
debug3: Ignored env HISTSIZE
debug3: Ignored env XDG_SESSION_COOKIE
debug3: Ignored env GJS_DEBUG_OUTPUT
debug3: Ignored env WINDOWID
debug3: Ignored env GNOME_KEYRING_CONTROL
debug3: Ignored env QTDIR
debug3: Ignored env QTINC
debug3: Ignored env GJS_DEBUG_TOPICS
debug3: Ignored env IMSETTINGS_MODULE
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env USERNAME
debug3: Ignored env SESSION_MANAGER
debug3: Ignored env GIO_LAUNCHED_DESKTOP_FILE
debug3: Ignored env PATH
debug3: Ignored env MAIL
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env QT_IM_MODULE
debug3: Ignored env PWD
debug1: Sending env XMODIFIERS = @im=none
debug2: channel 0: request env confirm 0
debug1: Sending env LANG = en_US.utf8
debug2: channel 0: request env confirm 0
debug3: Ignored env KDE_IS_PRELINKED
debug3: Ignored env GDM_LANG
debug3: Ignored env KDEDIRS
debug3: Ignored env GDMSESSION
debug3: Ignored env SSH_ASKPASS
debug3: Ignored env HISTCONTROL
debug3: Ignored env HOME
debug3: Ignored env SHLVL
debug3: Ignored env GDL_PATH
debug3: Ignored env GNOME_DESKTOP_SESSION_ID
debug3: Ignored env LOGNAME
debug3: Ignored env QTLIB
debug3: Ignored env CVS_RSH
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env LESSOPEN
debug3: Ignored env WINDOWPATH
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env DISPLAY
debug3: Ignored env G_BROKEN_FILENAMES
debug3: Ignored env COLORTERM
debug3: Ignored env XAUTHORITY
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Welcome to Ubuntu 11.10 (GNU/Linux 3.0.0-12-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

297 packages can be updated.
92 updates are security updates.

New release '12.04 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Fri Jun  8 07:45:15 2012 from 192.168.0.226
sun@SystemAX51:~$ ping 19<--------Lost connection again--------------

尾随:

-- dmesg 显示了非常不正常的日志,例如 Ubuntu 自动启动 eth0,而 eth0 也自动关闭。

[ 2025.897511] r8169 0000:02:00.0: eth0: link up
[ 2029.347649] r8169 0000:02:00.0: eth0: link up
[ 2030.775556] r8169 0000:02:00.0: eth0: link up
[ 2038.242203] r8169 0000:02:00.0: eth0: link up
[ 2057.267801] r8169 0000:02:00.0: eth0: link up
[ 2062.871770] r8169 0000:02:00.0: eth0: link up
[ 2082.479712] r8169 0000:02:00.0: eth0: link up
[ 2285.630797] r8169 0000:02:00.0: eth0: link up
[ 2308.417640] r8169 0000:02:00.0: eth0: link up
[ 2480.948290] r8169 0000:02:00.0: eth0: link up
[ 2824.884798] r8169 0000:02:00.0: eth0: link up
[ 3030.022183] r8169 0000:02:00.0: eth0: link up
[ 3306.587353] r8169 0000:02:00.0: eth0: link up
[ 3523.566881] r8169 0000:02:00.0: eth0: link up
[ 3619.839585] r8169 0000:02:00.0: eth0: link up
[ 3682.154393] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[ 3899.866854] r8169 0000:02:00.0: eth0: link up
[ 4723.978269] r8169 0000:02:00.0: eth0: link up
[ 4807.415682] r8169 0000:02:00.0: eth0: link up
[ 5101.865686] r8169 0000:02:00.0: eth0: link up

我如何解决它?

--http://ubuntuforums.org/showthread.php?t=1959794

$ apt-get install openipml openhpi-plugin-ipml
$ openipmish
> help
redisp_cmd on|off
> redisp_cmd on
redisp set

最终跟进:

步骤1:网卡驱动r8169的BUG

第 2 步:获取最新构建版本

http://www.realtek.com/downloads/downloadsView.aspx?Langid=1&PNid=4&PFid=4&Level=5&Conn=4&DownTypeID=3&GetDown=false&Downloads=true#RTL8110SC(L)

步骤 3:构建/制作

$ cd /var/tmp/driver
$ tar xvfj r8169.tar.bz2
$ make clean modules && make install

$ rmmod r8169
$ depmod
$ cp src/r8169.ko /lib/modules/3.xxxx/kernel/drivers/net/r8169.ko

$ modprobe r8169
$ update-initramfs -u
$ init 6

瞧!!

答案1

论坛链接给出了一个答案。这对您有用吗?

问题出在主板 BMC IPMI 功能上。它有自己的 MAC 地址,这会导致具有端口安全性的交换机出现问题。

IPMI 有一个专用的 LAN 端口,但如果只插入一根电缆,IPMI 将“劫持”该端口并在同一 IP 上发送偶尔的 arp 请求 = 问题。

以下是常规故障排除策略,以补充您已有的内容。为了完整起见,您可以附加netstat -aunt | head、 和的输出sudo ufw status吗? netstat(仅捕获标题行,您可能需要比默认多一些)应显示您的 ssh 守护进程正在监听(默认为 tcp 22)。 ufw status 应证实 iptables 告诉您的内容(即 iptables/防火墙没有干扰)。

另外,您有可用于执行操作的主机吗sudo nmap <yourboxname>?如果一切正常,这应该会显示 ssh open。

源主机和目标主机之间有哪些设备?交换机、路由器、防火墙等。如果子网中有第三台主机,它可以连接到第二台主机吗?

您的机器上有多个网络接口吗(例如有线和无线)?您ifconfig也可以发布输出吗?

您的上游是什么?也就是说,您是否直接连接到路由器、交换机、其他交换机等?

答案2

一切都错了,最后只修复了这个:(Ubuntu 11.10 的默认驱动程序转换不正确导致了这个问题)

Step 1: get it

http://152.104.125.41/search/default.aspx?keyword=RTL8111

http://152.104.125.41/downloads/downloadsView.aspx?Langid=1&PNid=5&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#RTL8111B/RTL8168B/RTL8111/RTL8168<br>RTL8111C/RTL8111CP/RTL8111D(L)<br>RTL8168C/RTL8111DP/RTL8111E<br>RTL8168E/RTL8111F

Step 2: cat README

# tar vjxf r8168-8.aaa.bb.tar.bz2
# ./autorun.sh  (as root or with sudo)


Step 3: lsmod | grep r8168 

note that: not 8169 was conflicting.


Works perfect now.

相关内容