Cannot SSH log into Debian virtual machine from windows 7 via Putty

10,086

Solution 1

In VirtualBox, under the port forwarding section, leave everything blank, just enter 22 in the two port fields.

This worked for me after twi hours of messing with other stuff, and reverting. I was able to get pings going, etc, but eventually read the last answer, and just tried entering 22 in the two fields. Works.

Solution 2

I'm having the exact same issue with that same tutorial, I made a question about it here:

Debian VM will not longer bring up the host-only interface

Since I only have 1 reputation, I can't comment any answers so I can't contribute to an answer.

So I'm just posting it here.

The answer to Jason H's question is that dhclient eth(#) produces this error:

RTNETLINK answers: File exists

Meaning the gateway route is already listed in the ip table.

And I don't understand why I get that error, since I never actually set a gateway to begin with.

Share:
10,086

Related videos on Youtube

Matthew Underwood
Author by

Matthew Underwood

Updated on September 18, 2022

Comments

  • Matthew Underwood
    Matthew Underwood over 1 year

    I have followed a tutorial from this website http://jtreminio.com/2012/07/setting-up-a-debian-vm-step-by-step/. I am up to the point in the tutorial where it says to login via SSH. I have installed Putty and logging in under debian-vm as the host name and I have also used 192.168.56.101 as a IP address. I get a connection timed out error every time I try to login.

    I have read other posts and suggestions pop up that it may be due to firewall issues or network related issues. Ultimately I am not well versed in networking so I really wouldn't know. Can someone suggest where to start to fix this issue or help me with any ideas they may have. I am using Oracle Virtual box with Debian 64 bit on Windows 7. I have OpenSSH installed on Debian, using NAT for adaptor 1 and Host only adaptor on 2. I have written to the files in Debian and I have written the IP address and host name into the hosts file on Windows 7 as instructed.

    • Zoredache
      Zoredache almost 11 years
      Use Bridged networking. Not NAT/Host only. Bridged is the better choice 95% of the time.
    • Matthew Underwood
      Matthew Underwood almost 11 years
      @Zoredache Tried bridged networking on both adaptor 1 and 2 with no luck.
  • kostix
    kostix almost 11 years
    @MatthewUnderwood, install telnet on your Windows box and try telnet 192.168.56.101 22 -- if you will also get timeout error then the port is either firewalled or some other configuration problem prevents packets from reaching that port or leaving the Debian host.
  • Matthew Underwood
    Matthew Underwood almost 11 years
    @kostix Tried that, could not open connection to the host, on port 22
  • kostix
    kostix almost 11 years
    @MatthewUnderwood, now what with Jason's suggestion -- can you ping the Debian host?
  • Jason H
    Jason H almost 11 years
    Ping from your windows box to the debian or vice versa. I think you may have the Windows 7 firewall running. What I suspect you'll see is that you can't ping the machine. Your Windows firewall may be on and stopping any traffic from reaching the VM. By the way, your SSH is actually listening. What you posted it shows that port 22 (SSHD) is actually running and waiting for connections.
  • Matthew Underwood
    Matthew Underwood almost 11 years
    @Jason H I tried to ping 192.168.56.101 but the request timed out.
  • Matthew Underwood
    Matthew Underwood almost 11 years
    Also just gone on preferences on virtual box and the host only adaptor, it says the host IPv4 network mask is wrong. The IPv4 network mask and address is both 0.0.0.0. This might be a clue im thinking.
  • Jason H
    Jason H almost 11 years
    Okay log into your debian machine and do a: "ifconfig" and see if eth(#) has an IP address associated with it, if it doesn't you need to assign one. But, you should already have one, so just type: "dhclient eth(#)" Where (#) is the number assigned to your ethernet adapter. Make sure you have the network adapter setup in virtual box. YOu should only need one adapter for your guest. Just set it up as nat.
  • Matthew Underwood
    Matthew Underwood almost 11 years
    I done all the instructions you gave me. disabled adaptor 2, started ssh on debian, got back tcp 0.0.0.0:22 LISTEN. I pinged IPV4 address on my windows machine from debian and that worked. The eth0 from the ifconfig has a inet addr of 10.0.2.15. I managed to ping to the windows machine without disabling the firewall.
  • Jason H
    Jason H almost 11 years
    Cool, have you tried to ssh to your debian box? If so what did you do and results did you get?
  • Matthew Underwood
    Matthew Underwood almost 11 years
    I am just reading a article about SSH, noticed my ipconfig dosent contain a Ethernet adapter VirtualBox Host-Only Network:, it just has two tunnel adaptors.
  • Matthew Underwood
    Matthew Underwood almost 11 years
    Virtual Box dosent allow me to port forward the Host only network adaptor.
  • Louis Waweru
    Louis Waweru almost 11 years
    How about for the NAT adaptor? Can you try connection on that IP?