您的位置:首页 > 理论基础 > 计算机网络

Hyper-V 安装 Redhat Linux 6.3 虚拟机的网络设置

2013-09-18 21:17 399 查看
  本篇主要讲述 Hyper-V 的 Redhat Linux 6.3 虚拟机的网络连接设置。

  Hyper-V安装Redhat Linux后连接不了外网,可以以 ROOT 用户登录系统,查看 IP。

[root@localhost ~]# ifconfig

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:16 errors:0 dropped:0 overruns:0 frame:0

          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:884 (884.0 b)  TX bytes:884 (884.0 b)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:2E:44:83  

          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

  显示没有可用的网卡,只有本地连接。需要在Linux里安装 Windows 的集成驱动:Linux Integration Services Version 3.4。不一定是这个版本的集成驱动,根据自己的情况下载相应的驱动。这是3.4版本的下载连接:http://www.microsoft.com/zh-cn/download/details.aspx?id=34603

  网卡驱动的安装

  打开 Hyper-V 管理器,进入虚拟机的设置界面。如果是旧版的网络适配器(Legacy Network Adapter),移除旧版的网络适配器,添加新版的 Network Adapter。



  

  在 DVD drive中挂载Linux Integration Services Version 3.4 镜像,然后启动虚机。



  下面是 Redhat Linux 中安装集成服务的过程:

[root@localhost ~]# cd /media/CDROM/

[root@localhost CDROM]# cd RHEL63/

[root@localhost RHEL63]# rpm -ivh kmod-microsoft-hyper-v-rhel63.3.4-1.20120727.x86_64.rpm 

Preparing...                ########################################### [100%]
package kmod-microsoft-hyper-v-rhel63.3.4-1.20120727.x86_64 is already installed

[root@localhost RHEL63]# ll

total 1949

-r-xr-xr-x. 1 root root   1496 Jul 31  2012 install.sh

-r--r--r--. 1 root root 885804 Jul 31  2012 kmod-microsoft-hyper-v-rhel63.3.4-1.20120727.i686.rpm

-r--r--r--. 1 root root 935800 Jul 31  2012 kmod-microsoft-hyper-v-rhel63.3.4-1.20120727.x86_64.rpm

-r--r--r--. 1 root root  28376 Jul 31  2012 microsoft-hyper-v-debuginfo-rhel63.3.4-1.20120727.i686.rpm

-r--r--r--. 1 root root  28544 Jul 31  2012 microsoft-hyper-v-debuginfo-rhel63.3.4-1.20120727.x86_64.rpm

-r--r--r--. 1 root root  10280 Jul 31  2012 microsoft-hyper-v-rhel63.3.4-1.20120727.i686.rpm

-r--r--r--. 1 root root  90963 Aug  1  2012 microsoft-hyper-v-rhel63.3.4-1.20120727.src.rpm

-r--r--r--. 1 root root  10700 Jul 31  2012 microsoft-hyper-v-rhel63.3.4-1.20120727.x86_64.rpm

-r-xr-xr-x. 1 root root   1235 Jul 31  2012 upgrade.sh

[root@localhost RHEL63]# rpm -ivh microsoft-hyper-v-rhel63.3.4-1.20120727.x86_64.rpm 

Preparing...                ########################################### [100%]

   1:microsoft-hyper-v      ########################################### [100%]

Saving old initramfs

Installing new initramfs

[root@localhost RHEL63]# 

  

  安装集成服务后可以查看是否有网卡,会发现多了个 eth0 的网卡

[root@localhost ~]# ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:15:5D:6A:87:07  

          BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

  现在你打开 Firefox 还不能连接外网,有了网卡,还要配置网卡。

  网卡配置

  默认 network 文件是没有的,下面会自动创建,填写 Hostname ,IP地址、网关地址选择动态分配、自动获取。

[root@localhost ~]# vi /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=issacyang

 [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

TYPE=Ethernet

BOOTPROTO=dhcp

ONBOOT=yes

IPV6INIT=no

USERCTL=no

HWADDR=00:15:5d:6a:87:08

PEERDNS=yes

  配置完之后,需要重启服务 service network restart

[root@localhost ~]# service network restart

Shutting down loopback interface:  [  OK  ]

Bringing up loopback interface: [  OK  ]

Bringing up interface eth0: [  OK  ]

  打开 Fiefox ,可以连接外网了。如果还不行,重启虚机。修改配置文件,不要改错,如果参数不合适,还可以用 system-config-network 进入图形界面修改网卡配置。

[root@localhost ~]# system-config-network



  

  到此为止, Hyper-V 里的 LInux 就可以连接外网了。如有纰漏,不吝赐教。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: