Configuring Network in CentOS 6.3 Virtual Box + Screenshots

Posted: May 23, 2013 in Uncategorized
Tags: /etc/sysconfig/network-scripts/ifcfg-eth0centos 6.3centos 6.5command lineconfigure networkinternetip addressterminalvirtual boxwindows 7

This is a guide on configuring network in CentOS 6.x in Virtual Box with screenshots (using terminal).

[UPDATE: This guide can also be used to configure network on CentOS 6.5]

So, here I have used CentOS 6.3 minimal and will be discussing on configuring the Virtual Box and CentOS for network access. If you need help installing CentOS minimal in the Virtual Box, you can find the instructions in my earlier post here.

Requirements:

  1. Virtual Box
  2. CentOS 6.3 or 6.5 (I have tested this on CentOS 6.3 and CentOS 6.5, you can use it on other 6.x versions too)

Step 1: Configure Virtual Box Network Settings:

There are different modes or ways you can configure your Virtual box network settings.

  1. Not Attached
  2. NAT
  3. Bridged Adapter
  4. Internal Network
  5. Host-Only Adapter
  6. Generic Driver

You can find more details about the different modes here.

I will be using the Bridged Adapter mode for this guide. It is faster as it treat the VM as an individual host within the network.

Open Virtual Box and right click on  your CentOS VM, and click on “Settings“.

Now, go to the tab Network and change the “Attached to” field to “Bridged Adapter”. Then choose the “Name” to your network interface. For example, I have a dell wireless adapter, so I choose the Name as “Dell Wireless” from the drop down menu. And finally check the field “Cable Connected Finally, click on OK when you are done.

So, you have now configured the Virtual Box. Now, you can start your CentOS VM by selecting you VM and clicking on “Start”.

Step 2: Configure CentOS network settings:

You can configure your network either by using Dynamic IP addressing assigned by your DHCP server or you can manually configure your IP Address statically. You can choose either static or dynamic method and can do so by editing the file/etc/sysconfig/network-scripts/ifcfg-eth0.

Method 1: Dynamic IP 

We can configure the network by using Dynamic IP address which are assigned automatically by the DHCP server. This is the simplest way to configure your network.

NOTE: You will have a line that starts with HWADDR in the your config file, do not change or modify that line.

In your terminal, type the following:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Now, add/modify the file as follows (DO NOT CHANGE the HWADDR line your config file):

DEVICE=eth0

BOOTPROTO=dhcp

ONBOOT=yes

NM_CONTROLLED=no

HWADDR=08:00:27:08:47:E9

Now, save the file by pressing “ESC” and typing :wq and hit ENTER.

To view your network config file. type the following in the terminal:

cat /etc/sysconfig/network-scripts/ifcfg-eth0

Now, you will have to restart your network. You can do so by typing the following in the terminal:

                service network restart

To view your IP address, type the following in your terminal:

                ifconfig eth0

You can see your IP Address of the interface eth0 next to the field “inet addr:” as shown below:

Now, if you have internet access, then you can check if you are able to ping any website. And you should be able to get the reply. For example, in your terminal type:

ping extr3metech.wordpress.com

You can press CTRL+ C to stop the ping command.

So, Hurray! you have successfully setup up your network in your CentOS Virtual Box.

Method 2: Static IP

We can also assign the network information manually by assigning the IP Address, NETMASK , GATEWAY in the network interface config file.

NOTE: You will have a line that starts with HWADDR in your config file, do not change or modify that line.

Step1 : In you terminal, type:

vi  /etc/sysconfig/network-scripts/ifcfg-eth0

Now, edit/merge the file to the following

DEVICE=eth0

BOOTPROTO=static

ONBOOT=yes

NM_CONTROLLED=no

HWADDR=08:00:27:08:47:E9

IPADDR=192.168.1.30

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

Now, press ESC and type :wq and hit ENTER to save and exit the configuration file.

To view the config file. type the following in the terminal:

cat /etc/sysconfig/network-scripts/ifcfg-eth0

Step 2: Change Host name: 

To change host name , you have to edit the config file /etc/sysconfig/network. If you want to know to change the host name manually, you can follow the guide I have posted earlier here.

Step 3: Assign DNS Server IP

To manually assign primary and secondary DNS Server IP addresses, in your terminal type: 

vi /etc/resolv.conf

Now, edit this file to the following:

nameserver 8.8.8.8          

nameserver 8.8.4.4

Now, press ESC and type :wq and hit ENTER to save and exit the configuration file.

Now, if you want you can make sure you have entered and saved the correct configuration(It is a good practice to double check ). To view your dns config file, in your terminal type:

cat  /etc/resolv.conf

Step 4: Restart network:

Finally, all you have to do is to restart your network service. To so so, type the following in the terminal:

                service network restart

Now, you can check your Current IP configuration, by typing the following in the terminal:

ifconfig eth0

Now, if you have internet access, then you can check if you are able to ping any website. And you should be able to get the reply. For example, In your terminal type:

ping extr3metech.wordpress.com

 

You can press CTRL+ C to stop the ping command.

So, Hurray! you have successfully setup up your network manually in your CentOS Virtual Box.

Hope this guide helped you to configure network in your CentOS Virtual Machine.

If you have any queries or suggestions regarding this guide, feel free to leave a comment and will get back at you. Don’t forget to follow my blog to get future updates! 

转载自:https://extr3metech.wordpress.com/2013/05/23/configuring-network-in-centos-6-3-virtual-box-screenshots/

Configuring Network in CentOS 6.3 Virtual Box + Screenshots的更多相关文章

  1. centos安装Oracle virtual box

    1.进入virtualbox官网 https://www.virtualbox.org/wiki/Downloads 2.点击Linux distributions 3.向下翻至如图 4.在/etc/ ...

  2. Virtual Box中 CentOS双网卡设置

    Virtual Box中 CentOS双网卡设置:   在Virtual Box中安装CentOS x86-64 6.4(final),配置了双网卡,eth0 为桥接模式 , eth1为内网模式   ...

  3. virtual box 下安装centos 7

    1: 在virtual box下导入 镜像的时候报错: Failed to open/create the internal network 'HostInterfaceNetworking-Virt ...

  4. 为 Virtual Box 中的 CentOS 6.6 配置本地DVD光盘做yum软件源

    因为virtual box 中的centos配置host-only共享win7上网,配置失败,所以只能使用Centos的 DVD 光盘来配置yum软件源.不然就没得完了. 1. 首先要在virtual ...

  5. Virtual Box + CentOS Minimal + Apache搭建Web服务器

    本文并不介绍关于Virtual Box, CentOS, Apache的安装, 主要针对安装后相关的配置, 使宿主机(Host)可以访问客户机(Guest: CentOS in Virtual Box ...

  6. 在centos 6.5 在virtual box 上 安装增强版工具

    centos 6.5 在virtual box 上 安装增强版工具: 出现:centos unable to find the source of your current linux kernel ...

  7. virtual box 安装centos min

    2018-4-19 22:20:40 星期四 之前不小心把用了很久的centos镜像删掉了.....这里记录下安装最小版centos的步骤 1. 安装centos 2. 开启网络, 并设置为随机启动 ...

  8. virtual Box在Centos 7上的安装

    1.首先,我们需要在oracle官网下载virtual Box的centos7版本: 下载地址为:http://download.virtualbox.org/virtualbox/5.0.12/Vi ...

  9. Virtual Box虚拟机Ubuntu18.X系统安装及Mysql基本开发配置

    Linux简介 什么是 Linux? Linux:世界上不仅只有一个 Windows 操作系统,还有 Linux.mac.Unix 等操作系统.桌面操作系统下 Windows 是霸主,而 Linux ...

随机推荐

  1. ztree获取当前选中节点子节点id集合的方法(转载)

    本文实例讲述了ztree获取当前选中节点子节点id集合的方法.分享给大家供大家参考.具体分析如下: 要求:获取当前选中节点的子节点id集合. 步骤: 1.获取当前节点 2.用ztree的方法trans ...

  2. iOS开发中的权限

    权限分类 联网权限 相册权限 相机.麦克风权限 定位权限 推送权限 通讯录权限 日历.备忘录权限 联网权限 引入头文件 @import CoreTelephony; 应用启动后,检测应用中是否有联网权 ...

  3. 自定义NSLog

    我们在调试程序的时候,往往需要输出一些日志信息,用到NSLog函数,当我们准备发布程序,需要注释掉NSLog代码,这个时候往往会定义一个宏,在调试的时候,会输出日志,在Release正式版本的时候,会 ...

  4. JS Util1(basic)

    1.

  5. PHP服务器配置环境变量

    我们写的PHP应用程序,通常会分别在本地.开发.测试.RC.生产环境中运行,不同环境中全局变量各不相同.通常简单的部署做法是,每次部署到一个环境,都需要先修改对应的全局变量,然后再部署代码.如果部署频 ...

  6. 这是用过的"最差"树形插件

      这是用过的"最差"树形插件 !!! 或许大家听过一个bootstrap UI框架---ace皮肤.有兴趣的童鞋可以在线查看:https://www.iteblog.com/ac ...

  7. 批处理——服务器的web文件备份

    首先建立三个文本文件,稍后会变成.bat结尾的批处理文件. 第一个文件:copyfile.bat[复制需要备份的文件到tmp文件下,等待压缩时使用] xcopy "D:\Webhost\*. ...

  8. h5视频上传之前端视频压缩研究

    今天领导接到一个h5上传手机视频的需求,主要是要看用户在这个视频中有没有完成某个任务,比如投篮进了几个球. 但是由于手机拍摄的视频文件大小有点大,直接上传的话,用户流量顶不住,而且特别耗时,在这样的情 ...

  9. 二十三、Java基础--------网络编程

    Java中另一个重要技术就是网络编程了,为了更好的学习web方向的知识,有必要对java之网络编程好好学习,本文将围绕网络编程技术进行分析. 常见的网络协议:UDP.TCP UDP 1. 将数据源和目 ...

  10. 图说js中的this——深入理解javascript中this指针

    没搞错吧!js写了那么多年,this还是会搞错!没搞错,javascript就是回搞错! ………… 文章来源自——周陆军的个人网站:http://zhoulujun.cn/zhoulujun/html ...