preface

We need a Linux VIRTUAL machine, and ensure that it is an independent IP in the LAN, to ensure that other virtual machines in the LAN (including the host machine) can SSH access to it

start

Here is the use of VirtualBox, download by yourself, centos7 image download also

Create a VM running Linux or RedHat by default

Self-set memory, 8G or more is recommended

The default VDI

Dynamic allocation

Set the storage location, preferably not in C disk

Once created, set up the disk

Choose an ISO image, centos7, and download it from the official website.

Set the NIC to a bridge NIC

Network mode has a variety of NAT, host only, bridge, etc., here the bridge is the most suitable for us, so to choose bridge, simple to say that you can exclusive IP

Adjust the boot sequence

Start the

Select an Installation position

Choose the one with the UI

Enabling Ethernet

10.10.0.17 is the default GENERATED IP address. After the installation, reset the static IP address of the network adapter

Start the installation

Set the root password and user name

Opening permit

Open a network connection

Enable SSH 22 or disable the firewall

On 22

firewall-cmd --zone=public --permanent --add-port=22/tcp  
Copy the code

Disabling the Firewall

Systemctl stop firewalld # Disable firewall systemctl disable firewalld # Disable automatic startupCopy the code

Setting a Static IP Address

ip addr
Copy the code

You can view your OWN IP, which is now dynamic by default

At this point, other machines can be SSH access

Now let’s set up static fixed IP

Go to the bridge Settings directory

cd /etc/sysconfig/network-scripts/
Copy the code
ls
Copy the code

Modify ifcfg-enp0s3, this may be different for each person

sudo vi ifcfg-enp0s3
Copy the code

Add or modify Settings

These Settings can first check the host configuration, including the subnet mask, gateway, DNS, etc

BOOTPROTO=static ONBOOT=yes # IPADDR=10.10.0.44 # NETMASK=255.255.240.0 # NETMASK= 10.10.10.1 X.X.X. 1dns1 =61.139.2.69 DNS NM_CONTROLLED=noCopy the code

Restart the network card

systemctl restart network.service
Copy the code

The last

ip addr
Copy the code

Viewing network Addresses

This is what we want, 10.10.0.44 is static IP

Then you can ping Baidu.com, test, the Internet should be no problem

All other machines in the LAN, including other virtual machines, can be accessed by SSH.

About the author

The author is a programmer who loves learning, open source, sharing, spreading positive energy, likes playing basketball, and has a lot of hair. –

Warmly welcome everyone to pay attention to, like, comment exchange!

Jane: www.jianshu.com/u/d234d1569…

github:github.com/fly7632785

CSDN:blog.csdn.net/fly7632785

The Denver nuggets: juejin. Cn/user / 993614…