# Connecting to freebsd on VM with ssh



## mahdyar (Oct 31, 2018)

Hello, I have some problems with connecting to my freebsd !

It's my ifconfig:






and as you can see, there is not any ip to starts with my range .

and It's my virtualbox configure :





I have same configure for my another machine that is ubuntu and i can ssh on it .

Sorry if it's stupid problem .

Best


----------



## SirDice (Nov 1, 2018)

Your em0 interface appears to be connected to the network. Is sshd(8) actually running? Are you perhaps trying to SSH as root (that's not allowed)?


----------



## mahdyar (Nov 1, 2018)

Actually, I don't have ping from 10.0.2.15 .
And sshd is running :


----------



## skhal (Nov 1, 2018)

My VirtualBox configuration for the VM includes two network interfaces:

Host-Only adapter
NAT
I believe, you need to create a virtual device for the 1st one in VirtualBox/Preferences/Network.

The sshd(8) runs on the first interface. It allows to connect to VM from localhost only:


```
skhal@host:~ % sysrc -a | grep '\(em0\|sshd\)'
ifconfig_em0: inet 192.168.56.100/24
sshd_enable: YES
sshd_flags: -o ListenAddress=192.168.56.100
```


----------



## mahdyar (Nov 1, 2018)

skhal said:


> My VirtualBox configuration for the VM includes two network interfaces:
> 
> Host-Only adapter
> NAT
> ...


Thank You, It's solved .


----------



## al mello (Nov 1, 2018)

mahdyar said:


> Hello, I have some problems with connecting to my freebsd !
> I have same configure for my another machine that is ubuntu and i can ssh on it .
> 
> Sorry if it's stupid problem .
> ...



Glad it's fixed. Out of curiosity ... Your configured network was set to NAT, not BRIDGED, and getting a 10.0.2.0/24 IP. What's your LAN IP?


----------



## SirDice (Nov 1, 2018)

mahdyar said:


> Thank You, It's solved .


Please share your solution, it might be helpful for other people running into the same problem.


----------



## mahdyar (Nov 1, 2018)

SirDice said:


> Please share your solution, it might be helpful for other people running into the same problem.


I used this configure on virtualbox :

NAT
Host-Only adapter
and then I  edited my /etc/rc.conf and added this :
`ifconfig_em1="DHCP"`

That was all .


----------

