Make an ssh connection from Mac / VirtualBox (CentOS)

1 minute read

1. VirtualBox settings

–Click [File] → [Host Network Manager]
スクリーンショット 2020-08-23 1.52.51.png
–Click the create button to create 192.168.56.1
–Check the DHCP server and close it
–If you want to change other settings, change them in the properties.
スクリーンショット 2020-08-23 1.57.25.png
–ssh Select the CentOS you want to connect to and press the setting button
スクリーンショット 2020-08-23 1.48.18.png
–Select a network


Adapter 1 setting

Check Enable network adapter
Allocation: NAT
スクリーンショット 2020-08-23 2.00.10.png

Adapter 2 settings

Check Enable network adapter
Allocation: Host Only Adapter
Name: vboxnet0 (select the one created by the host network manager)
スクリーンショット 2020-08-23 2.02.42.png

Press OK to close the screen

2. CentOS settings

–Start CentOS
スクリーンショット 2020-08-23 2.05.53.png
–Log in as root user and execute the nmtui command
スクリーンショット 2020-08-23 1.35.10.png
–Select “Edit a connection”
スクリーンショット 2020-08-23 2.07.58.png
–Select ʻenp0s3 with the lower button, press the right button, select <Edit …> and Enter ![スクリーンショット 2020-08-23 1.37.46.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/696107/f9907a2e-4664-d04d-bd3d-1da3c934f232.png) --Set the following in Edit Connection and close with OK --Changed IPv6 CONFIGURATION from Automatic to Ignore --Check Automatically connect by pressing a space ![スクリーンショット 2020-08-23 1.44.17.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/696107/d4c42ce7-8092-6648-7da4-994b4fd2f402.png) --Since it returns to the list, select the one with garbled characters this time, select the right button <Edit …> and Enter --Set the following in Edit Connection and close with OK --Changed Profile name to ʻenp0s8
–Changed IPv4 CONFIGURATION from ʻAutmatic to Manual --ʻMove the cursor to <show> of IPv4 and Enter
–Added 192.168.56.11/24 to Addresses
–Changed IPv6 CONFIGURATION from ʻAutomatic to ʻIgnore
–Check Automatically connect by pressing a space
スクリーンショット 2020-08-23 2.22.54.png

–When you return to the list, move the cursor to Back and Enter
スクリーンショット 2020-08-23 2.18.04.png
–When you return to NetworkManager TUI, select Quit and Enter

–Restart the network

# systemctl restart NetworkManager
# systemctl restart network

3. Ssh connection from Mac terminal

–Connect

Type yes if you are asked for anything

This completes the ssh connection settings

4. Reference

https://qiita.com/ryubb_SU/items/782fd6a0614d9855e3b4
https://qiita.com/ebkn/items/751ed657629ba8d4ab0a