r/linuxfromscratch • • Mar 10 '25

SSH in VirtualBox

I have the LFS set up in a VM. Now i need to keep using it for some school assignments and i want to set up SSH so its easier to work with it. I followed all the steps in this link

I can access ssh from the machine itself but when trying from the host i cant reach it. I have the network adapter set to NAT and i have forwarded the correct ports. When i try to access via SSH it hangs for a bit and then throws this message:

$ ssh root@127.0.0.1 -p 3434
kex_exchange_identification: read: Connection reset by peer
Connection reset by 127.0.0.1 port 3434

I also tried setting up an http server with python to check if it has something to do with the ssh config but i also get an error:

$ curl -v 127.0.0.1:8080
*   Trying 127.0.0.1:8080...
...
* Request completely sent off
* Recv failure: Connection reset by peer
* closing connection #0
curl: (56) Recv failure: Connection reset by peer

If anyone knows what config could i be missing or any guides/resources i could look at that would be great. I don't really know much about how to configure networking on linux so i may be missing something really obvious.

ip a output
1 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/ojodesombra Mar 11 '25

OK this worked but in a weird way. in the screenshot i have 2 adapters configured.

  1. The NAT i was talking about
  2. A bridge adapter. This is supposed to be the enp0s8. But this was throwing an error on boot saying "Interface enp0s8 doesn't exists"

What i did is i removed the second one and tried with one bridge adapter. It only allowed me to give it the name enp0s8 so i did that. I got the same error but when connecting with the ip of the enp0s3 it just worked

I guess the enp0s3 is created by Vbox by default ?? Anyway doing:

ssh root@192.168.1.2

just worked so thank you <3