cannot connect to host 127.0.0.1 Virtualbox - macos

So I'm using a Macbook Pro with virtualbox and trying to SSH to CentOS virtual machine.
I've started the SSH service on centOS and I've gone into the network settings of virtualbox and made sure that the adaptor was set to NAT and that port forwarding was set to port 22 for the guest and host.
When I run the following on my mac: ssh 127.0.0.1
It says: ssh: connect to host 127.0.0.1 port 22: Connection refused
Any ideas why?

Fixed the issue by enabling ssh on mac. I didn't realize it was off as default! If you go into the sharing options in system preferences you can tick a box which enables ssh. To connect you must use: $ ssh username#192.168.1.111 (or whatever the ip is of the machine).

Related

Virtualbox and host connection problem: unable to ping and ssh connection from host to VM, but VM to Host ping and ssh connections working

I have been searched many resources, but I can't solve this problem.
Firstly, I want to clarify that, my windows 10 all firewall options are turned off (also turned off ubuntu server 16.04)
Windows firewall settings
this is my host machine ip configuration (windows 10)
Host machine IP
this is my NatNetwork configuration in Virtualbox
NatNetwork configuration in Virtualbox
this is my port forwarding configuration in NatNetwork
Port Forwarding configuration
I want to mention that when I use 127.0.0.1 Ip address as a port forwarding HOST IP address. this is not working also, but I can ping from my host to 127.0.0.1 IP address.
this is my ubuntu_server 16.04 ip configuration
Ubuntu_server 16.04 IP configuration
When I ping from ubuntu_server to my HOST (from 172.31.0.4 to 192.168.0.110), I can ping
from VM to HOST ping
But I can't ping from HOST to VM (from 192.168.0.110 to 172.31.0.4), I get the request timed out.
enter image description here
So, I can't ping from HOST to VM, please help me solving this problem
I have a problem VM and HOST connection.

Having trouble in accessing my virtual machine from local with SSH

I've ubuntu 16.04 on both my local and virtual machine, I want to access my virtual machine from my local machine, I've already changed the network adapter to bridge connection (both ips are in 192.168,10.x). But when i run the ssh virtual_mac_ip from my local terminal i get the error ssh: connect to host 192.168.10.7 port 22: Connection refused.
ps: I want to configure single node hadoop cluster
The issue has been resolved I changed my network adapter to NAT again, and use port forwarding on port 2222. Now when I run "ssh -p 2222 username#127.0.0.1", I am able to connect to my guest OS
Side note: Please check if OpenSSH is installed on your guess machine

Connection timeout error for winscp to cloudera vm

I am trying to connect Cloudera VM from my Windows desktop using Winscp for file transfer.
But I am not able to connect it using winscp. It is showing me connection timeout error.
Anybody has any idea how to solve this issue.
Thanks,
Atul
I figure out, bow to do it. The error was I am referring wrong IP address. To know right IP address and connect follow below steps.
First, if the Cloudera VM is running then shutdown it.
Second, go to setting. refer below screenshots
Then start the Cloudera VM again.
Go to terminal.
Type the command ifconfig.
On Consol you will find eth1 - where you have to look for ipnet, next to it is your IP address, which you have to use to connect to VM. note down the address.
Go to windows.
Open Winscp.
Create New Site.
Put the host name as the IP address which we got from consol
Username- cloudera, password- cloudera
Port-22
Click on Save.
Click on login.
Hope this will help.
Thanks,
Atul
I can connect to cloudera VM 5.15 from winSCP from my laptop(windows).
I am using Virtual box.
I have downloaded VM from cloudera official site and then choose option file-import appliance ,it will choose by default Network adapter NAT and then I followed as mentioned below.
add cloudera.quickstart in hosts file
C:\Windows\System32\drivers\etc\hosts
localhost name resolution is handled within DNS itself.
127.0.0.1 localhost quickstart.cloudera
Recommended VirtualBox Configurations
Right click on the VirtualMachine and click Settings
Setup the VM to allow you to copy and paste from that machine to your local and vice-teversa
Click on General -> Advanced
Set Shared Clipboard to Bidirectional
Setup port forwarding from port 2222 to port 22 to allow SSH to the machine
Click on Network -> Advanced -> Port Forwarding
Add a new entry
Name: 2222
Host Port: 2222
Guest Port: 22
Accessing the VM
SSH’ing to the Machine
Default SSH Credentials: cloudera/cloudera
Host to connect to: localhost
Because of the Recommended VirtualBox Configuration above, we’re forwarding connections from port 2222 to 22. So you would want to use port 2222 to connect.
Windows
Open putty/winscp
Use ip as 127.0.0.1
Set 2222 as the port
Connection Type: SSH
Click open
Enter the password

Connection timed out while copying ssh key from CentOS to Ubuntu using ssh-copy-id

I'm trying to copy my public key from a CentOS environment to a Ubuntu machine. I used the following command
ssh-copy-id root#Ubuntu_IP
However I get an error saying Connection timed out. I'm able to ping from my host to the remote machine. The purpose behind this is that my host machine is ansible control node where as Ubuntu machine is my managed node.
Make sure you add a permanent route in the remote machine for the host machine.
route add -net remote_ip netmask mask_ip gw gateway_ip eth0
Also disable the firewall on the remote machine. This seemed to have solved the problem in my case.

Connecting to Windows SSH Server

I am a newbie trying out SSH. The scenario is I have 2 machines - Windows 7 PC(Desktop) and a VMWare machine (Windows 7). Cygwin installed on both. I am trying to connect the VMWare machine to the desktop. I have installed the OpenSSH server on Desktop server. I verified it is running, using netstat.
I modified the Windows firewall, by adding to the Inbound Rules to allow connections for port 22.
My problem is I am unable to connect from the VMWare machine.
$ ssh -v user_name#my_machine
OpenSSH_5.5p1, OpenSSL 0.9.8q 2 Dec 2010
debug1: Connecting to my_machine port 22.
debug1: connect to address my_machine port 22: Connection refused
ssh: connect to host my_machine port 22: Connection refused
What am I doing wrong? What are my options to configure? Any links or answers would be helpful.
Thank you.
WM
Open your command prompt and run the following command:
ssh -v Your_User_Name#Your_IP_Address
If response is:
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Connecting to Your_IP_Address port 22.
debug1: connect to address Your_IP_Address port 22: Connection refused
ssh: connect to host Your_IP_Address port 22: Connection refused
Then go to the Windows Service called OpenSSH SSH Server is started and running, it is set to manual start as default so it will not be running unless you have started it.
Now run above command again. SSH command will connect to the user.
You should make sure that my_machine allows inbound connection. Check the firewall....
(if you can run this command locally - but not from the other machine it might be that case).
If the ssh server on the Desktop is accessible in the localhost then try this
Desktop <- Desktop Firewall <- VM Firewall <- VM
Try shutting down the firewalls in between one by one to check where the issue starts after then configure accordingly. Remember that the Desktop Firewall rules should be inbound and the VM Firewall is outbound

Resources