VirtualBox + CentOS uses NAT + host-only mode networking

Source: Internet
Author: User

Before the use of VMware as a virtual machine, these days to see < with Amin learning Linux>, which is used in the virtual machine is the Oracle VirtualBox, but also with the installation of a configuration, but compared to the pit is the above configuration toss a long time to fix, You can not connect to the server via SSH. Now record the process of configuring the network.

The version that uses Oracle VirtualBox is 5.0.12 r104815, and the system image is CentOS 6.6.

① after installing CentOS 6.6, shut down the system

② in VirtualBox main control interface Click "Manage"--"global setting"--"network"-"Add new NAT Network"

③ in the popup dialog box, set "Network CIDR" to "192.168.100.0/24", "OK"

④ in the Management interface Click "Settings"--"network"-"Nic 1", "Connection mode" select "Nat Network", "Interface Name" selected "Natnetwork", "OK"

⑤ "Start"

After landing into the system, run:

# Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Change "Onboot" to "yes":

Device=eth0hwaddr=08:00:27:29:8d:5atype=ethernetuuid=48f940f9-be30-4a00-b660-378e9414e31aonboot=yesnm_ Controlled=yesbootproto=dhcp

Restart Network Service:

# Service Network Restart

At this point the network can be normal, ping an address to try.

However, it is not possible to login to the server via SSH.

⑥ shut down the system.

In manage--Global settings--network, you should see the "host-only (host-only) network" tab. After VirtualBox is installed, you can see VirtualBox host-only network in your computer's networks and sharing center-change adapter settings:

Right-click Properties--Internet Protocol version 4 (TCP/IPV4) to see that the IP address is "192.168.56.1":

Back to VirtualBox, select "Edit Host-only (host-only) network". can see:

⑦ "Settings"--"network"-"NIC 2"--"Enable network connection", "Connect by" select "Host (host-only) network only":

  

Boot.

⑧ execute the following command:

# cd/etc/sysconfig/network-scripts/# CP Ifcfg-eth0 ifcfg-eth1# VI ifcfg-eth1

Delete the "HWADDR" line, delete the "UUID" line, add "ipaddr" and "NETMASK", modify "DEVICE" to "eth1", "Bootproto" to "static":

device=eth1type=ethernetonboot=yesnm_controlled=yesbootproto=staticipaddr=192.168.56.101netmask=255.255.255.0

Restart the Network service.

You can now connect to "192.168.56.101:22" using SSH.

VirtualBox + CentOS uses NAT + host-only mode networking

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.