How do I configure networking on CentOS 6 running on hyper-v?

10,014

Solution 1

Have a look in /etc/sysconfig/network-scripts/ifcfg-eth0 there should be a line that says ONBOOT=yes which causes eth0 to be configured when the system starts.

Solution 2

In my case once I added the integration services I went in and created the ifcfg-eth0 file with the following

DEVICE=eth0 BOOTPROTO=dhcp HWADDR=(fill in yours) ONBOOT=yes

then I ran system-config-network and added my DNS servers (this may not have been necessary)

once I did that and restarted the network service it started responding to CentOS 6.3 .

This was under HyperV built into Windows 8 Enterprise

Solution 3

Adding to lain's answer..

I'm running Hyper-V, CentOS 6.2.

  1. When initially setting up your VM for CentOS, do the "delete the network adapter...add a legacy adapter" like everyone says.
  2. AFTER that, install CentOS
  3. Upon first boot, run system-config-network. You should see eth0. Edit it.
  4. eth0 should show it is set to DHCP ... [*]. I changed my to static.
  5. cd /etc/sysconfig/network-scripts
  6. ifup eth0 (run it)...it should take a moment while the interface initializes
  7. Try to ping your gateway.
  8. Follow lain's instructions to get your eth0 to start at boot.
Share:
10,014

Related videos on Youtube

Adrian Mihai
Author by

Adrian Mihai

Updated on September 18, 2022

Comments

  • Adrian Mihai
    Adrian Mihai over 1 year

    I'm not using legacy adapters, and i've installed Linux Integration Components 3.2.

    THe problem i'm facing is that the command 'setup' or 'system-config-network' doesn't list any network interfaces. If i run ifconfig -a i can see both the network cards i've attached. By setting a ip using ifconfig i can get network connectivity. The problem is that it's not persistent after a reboot.

    I'm a 100% centos newbie, but I figure it has something to do with that the centos installer couldn't see the NICs on install.

    How can I fix this?

  • Adrian Mihai
    Adrian Mihai over 12 years
    There's no such file. But creating it with Device=eth0 and restarting /etc/init.d/network made it visible for system-config-network so now it's working :)