How does one configure the network address for Linux in Hyper-V?

Source: Internet
Author: User

Once a week, Linux is installed in Hyper-V 2012 and IC 3.4 is also installed. However, the IP address cannot be configured. This causes a lot of inconvenience, so I tried to find a chance to solve the problem.


In this process, I would like to thank my colleagues for their prompt, so that I can quickly find a solution.


Here we will summarize the precautions for installing Linux in Hyper-V:

1. Select the Linux version correctly. For details, see the compatibility list on the official website.
2. install Linux IC 3.4
Mkdir/ic
Mount/dev/cdrom/mnt/cdrom (if mounting fails, run mkdir/mnt/cdrom first)
Cp/mnt/cdrom/RHEL6.3/ic (first confirm the copied ic Version)
Switch to the/ic/RHEL6.3 directory
Run./install. sh
Wait until the installation is complete and run reboot.
Note: If a permission problem occurs, use chmod-R 777/ic to obtain the permission.

3. Use the ifconfig-a command in Linux to confirm that the NIC has been correctly identified. Except for the lo Nic, you must recognize eth0 and other NICs)

By now, Linux has recognized the virtual network card. If you still cannot configure the IP address, you need to manually create the configuration file:

Linux Nic configuration files are divided into two
/Etc/sysconfig/network
/Etc/sysconfig/network-scripts/ifcfg-eth0
If the two files are not in the specified directory, you need to create them manually. The creation steps are as follows:

Vi/etc/sysconfig/network (although this file is not available, it can still be edited. After editing, switch to the command line of vi and use wq to save it)
The configuration file is as follows:
NETWORKING = yes
HOSTNAME = Linuxtest
GATEWAY = 192.168.1.254 based on the actual address)
After creating the network file, create the/etc/sysconfig/network-scripts/ifcfg-eth0eth0 again. Modify according to the content displayed in ifconfig-)
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
The content of this configuration file is as follows:
DEVICE = eth0 according to the actual situation)
BOOTPROTO = static method for obtaining ip addresses. If it is automatically obtained, it is changed to dhcp)
IPADDR = 192.168.1.140
NETMASK = 255.255.255.0
GATEWAY = 192.168.1.1
ONBOOT = yes automatically activated upon startup)

After creation, restart the NIC service using: service network restart.

OK! Enjoy!

This article is from the "TimeThin" blog, please be sure to keep this source http://timethin.blog.51cto.com/480772/1288831

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.