简体   繁体   English

如何在 VirtualBox 上安装 CentOS 配置 inte.net

[英]How to configure internet on CentOS installation on VirtualBox

I am a beginner to linux. I have done the fresh installation of CentOS 7 on my Windows VirtualBox.我是 linux 的初学者。我已经在我的 Windows VirtualBox 上完成了 CentOS 7 的全新安装。

Over the tutorials for CentOs 6 they have mentioned to edit /etc/sysconfig.network-scripts/ifcfg-eth0 file for the configurations.在 CentOs 6 的教程中,他们提到要为配置编辑 /etc/sysconfig.network-scripts/ifcfg-eth0 文件。

But in my installation there is no such file.但是在我的安装中没有这个文件。 I have ifcfg-enp0s3 and ifcfg-lo files available.我有可用的 ifcfg-enp0s3 和 ifcfg-lo 文件。

From the CentOS tutorial, the eth0 portion of /etc/sysconfig/network-scripts/ifcfg-eth0 refers to the network interface.从CentOS的教程时, eth0部分/etc/sysconfig/network-scripts/ifcfg-eth0指网络接口。 eth0 is the most common name for a standard ethernet interface in Linux. eth0是 Linux 中标准以太网接口最常见的名称。 From your question, your system has two interfaces: enp0s3 and lo .根据您的问题,您的系统有两个接口: enp0s3lo lo is the loopback interface, so ignore that one. lo是环回接口,所以忽略那个。 That leaves enp0s3 .这留下了enp0s3

Go ahead and follow the instructions with /etc/sysconfig/network-scripts/ifcfg-enp0s3 .继续并按照/etc/sysconfig/network-scripts/ifcfg-enp0s3 It should work, assuming that interface doesn't have any weird quirks associated with it.它应该可以工作,假设该界面没有任何与之相关的奇怪怪癖。

Same here!同样在这里! I installed CentOS 7 in Windows7 Virtulabox, there is no eth0 , but enp0s3 .我在 Windows7 Virtulabox 中安装了 CentOS 7,没有eth0 ,而是enp0s3

  • After first reboot, used command ip addr , enp0s3 had no ip address bundled;第一次重启后,使用命令ip addrenp0s3没有绑定ip地址;
  • Then I updated /etc/sysconfig/network-scripts/ifcfg-enp0s3 , changed ONBOOT=no to ONBOOT=yes , enp0s3 had ip 10.xxx, still useless;然后我更新了/etc/sysconfig/network-scripts/ifcfg-enp0s3 ,将ONBOOT=no改为ONBOOT=yesenp0s3有 ip 10.xxx ,还是没用;

Then I updated /etc/sysconfig/network-scripts/ifcfg-enp0s3 according to the accepted answer of centos minimal installation static ip address , it works!然后我根据centos最小安装静态IP地址的公认答案更新了/etc/sysconfig/network-scripts/ifcfg-enp0s3 ,它有效! As my IP address of Ethernet adapter VirtualBox Host-Only Network is 192.168.56.1, I set 192.168.56.35 to enp0s3 , and my vbox NIC mode is Host-Only .由于我的Ethernet adapter VirtualBox Host-Only Network IP 地址是 192.168.56.1,我将 192.168.56.35 设置为enp0s3 ,我的 vbox NIC 模式是Host-Only

  • Type nmtui in the terminal在终端输入 nmtui
  • Go to 'edit connection' and hit enter转到“编辑连接”并按回车键
  • Select 'enp0s3' and hit enter选择“enp0s3”并按回车键
  • Go down to 'Automatically connect' using down arrow key使用向下箭头键转到“自动连接”
  • Press space bar按空格键
  • Go down and press hit enter on 'Ok'往下走,然后在“确定”上按回车键
  • Go back and quit返回并退出

It worked for me like this on windows 10 -Change Adapter 1 Name to "Remote NDIS based Inte.net Sharing Device"它在 windows 上对我有用 10 - 将适配器 1 名称更改为“基于远程 NDIS 的 Inte.net 共享设备”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM