Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

Time:2022-1-8

Premise: the CentOS system has been installed on the VirtualBox
1: Network card configuration of CentOS
1.1 open VirtualBox, select the system to be configured, click settings and select network

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

1.2 you can see the network cards configured for our CentOS virtual machine here. Up to 4 network cards can be enabled. Here, we only enable one. Select the bridge network card in the connection mode (in this mode, you can communicate with the local host or network through the local host network),

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

1.3 select interface name
//Select Realtek PCIe GBE family controller when the local host is networked through broadband
//Select the Atheros ar9485 wireless network adapter when the local host is networked through the wireless network
Here I choose Realtek PCIe GBE family controller

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

Click OK
1.4 start the CentOS virtual machine, preferably log in as root (to avoid permission problems)
1.5 execute the setup command (unique to RedHat)
//The setup command can permanently modify the network configuration, and will not be invalid next time you restart

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

1.6 enter the following interface to enter network configuration

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

1.7 enter device configuration

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

1.8 enter eth0, that is, the configuration of our network card 1

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

Here, we can choose to dynamically obtain the IP address and statically configure the IP address through the DHCP server
Static: enter the use DHCP option into the space bar, and then view the network information of your local host

Manually configure static IP (static IP address), netmask (subnet mask), default gateway IP (default gateway) and primary DNS server (preferred DNS server) in order to ensure that the IP address configured for the virtual machine and the local host are in the same network segment. The second DNS server is not filled in, and the last three items are filled in*

Dynamic: enter the use DHCP option, fill in the last three items
Here I choose to obtain IP dynamically (the IP address obtained at each startup may be different)

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

Press tab and select OK
1.9 save and exit all the way according to the following pictures

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

1.10 execute service network restart to restart the network to make the configuration effective

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

1.11 execute ifconfig to view the dynamically allocated IP address (192.168.1.107)

2: Connect the virtual machine with putty on the local host (Windows)
2.1 start sshd service in CentOS and execute

    chkconfig sshd on 
    service sshd start

Execute ifconfig on the virtual box virtual machine to view the currently dynamically allocated IP address (192.168.1.107 as shown in the figure above).
(the IP address here is dynamically allocated. The allocation is different each time you start)
2.2 open putty, enter the above IP and port (default 22) in putty, and click open to connect

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

2.3 click Yes

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

2.4 enter the user name and password (hidden) and successfully enter…………..

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

3 connect the virtual machine with winscp on the local host (Windows)
3.1 open winscp, click new site, enter IP address, user name and password, default SFTP and 22 with File protocol and port number, do not change, and click login.

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

3.2 click Yes

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows

3.3 successful connection

Centos6 on VirtualBox 8 network configuration of virtual machine and connection using putty and winscp under Windows