pwrusr.com

  • Home
  • Download
  • About
  • Contact
'

[SOLVED] CentOS 6 networking and Hyper-V.

March 1st, 2012 by Andrea Matesi 993 Views

Recently I have been playing with CentOS on Hyper-V. My personal opinion is that both products are great.

My lab is made of:

  •     Microsoft Windows Server 2008 R2 w/SP1.
  •     Hyper-V Role enabled.
  •     CentOS 6.2 x64 minimal iso.
  •     Linux Integration Services for Hyper-V version 3.2 w/ synthetic drivers.

I experienced networking problems while CentOS was booting, more specifically:

/var/log/dmesg:eth0: Dropping NETIF_F_SG since no checksum feature.
/var/log/messages:Mar  1 11:00:25 pwrusrdev1 kernel: eth0: Dropping NETIF_F_SG since no checksum feature.

This specific issue seems related to the fact that the "Checksum offload feature" is missing from the virtual ethernet interface. But since we're speaking about a virtual interface, and the feature we're talking about is a hardware feature, implemented by manufacturers such as intel inside their ethernet silicon to offload the Checksum calculations from the CPU, consider this thing just a naggie and no more.

CentOS minimal doesn't have a gui, so no network config here, but I can live with that :)

Now many people are wondering "why CentOS minimal" and "CentOS minimal sucks", but on my next article series I'm gonna show you how great CentOS minimal is and how to put this smart Linux distribution to good use.

Consider this article as an entréé on CentOS6-minimal networking configuration.

So, I was configuring networking by creating a _single_ config file inside /etc/sysconfig/network-scripts/ifcfg-eth0
with the following lines:

nano /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
NETWORK=192.168.1.0
NETMASK=255.255.255.0
IPADDR=192.168.1.4

As you can see, I was trying to setup a static IP address on eth0. But generating only this file for CentOS networking simply isn't enough.

[UPDATE 03/APR/2012]: After Mr. Matt Gorecki comment, I've researched a more viable and efficient alternative and I've found a very clever description from Mr. Mark Wagner at the following address: http://serverfault.com/questions/189445/what-is-the-order-of-precedence-for-redhat-network-configuration-files.

Basically, he explains that CentOS Network Manager scripts create hard links instead of what I suggested.

My original description was (ignore it!):

You'll have to copy this file inside 2 other directories, like so:

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/networking/devices/
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/networking/profiles/default/

And make sure their permissions are set correctly, like so:

chmod 644 /etc/sysconfig/network-scripts/ifcfg-eth0
chmod 644 /etc/sysconfig/networking/devices/ifcfg-eth0
chmod 644 /etc/sysconfig/networking/profiles/default/ifcfg-eth0

The following is my new explanation (follow it!):

Since CentOS scripts seems to create hard links when defining ethernet devices, to maintain uniformity with what CentOS does, you can:

ln /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/networking/devices/ifcfg-eth0
ln /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/networking/profiles/default/ifcfg-eth0

Once this is done, you'll have to name you computer with the hostname command:

hostname my-system-name

Then you need to edit another file, /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=my-system-name
GATEWAY=192.168.1.1

Save and set its permissions to 644 like so:

chmod 644 /etc/sysconfig/network

Reboot and your networking should be working just fine.

Bonus: once we're at it, let's set up name resolution! Open /etc/resolv.conf and input a "nameserver statement" like this:

nameserver 192.168.1.1

Posted in LINUX, Microsoft, System Administration | 13 Comments »

13 Responses to “[SOLVED] CentOS 6 networking and Hyper-V.”

  1. f0yNo Gravatar says:
    Wednesday, 28 Mar, 2012 at 6:39 pm

    Thanks! I am newbie in CentOS and your article was very helpful!

    Reply
  2. amatesiNo Gravatar says:
    Wednesday, 28 Mar, 2012 at 9:26 pm

    you're welcome :)

    Reply
  3. Matt GoreckiNo Gravatar says:
    Sunday, 1 Apr, 2012 at 8:17 am

    Copying the files to /device and /profiles isn't necessary.
    /etc/sysconfig/network is the critical file that isn't created by default.

    Reply
    • amatesiNo Gravatar says:
      Tuesday, 3 Apr, 2012 at 10:38 pm

      Hello Matt and thanks for your comment, according to your suggestion, I’ve researched for a more efficient alternative, I tested it and I’ve amended my article.

      Reply
  4. Luis FreitasNo Gravatar says:
    Thursday, 3 May, 2012 at 4:41 am

    My congratulations. .
    optimal solution!

    Reply
  5. MilenaNo Gravatar says:
    Thursday, 7 Jun, 2012 at 12:03 am

    Perfect. Thank you.

    Reply
  6. NickNo Gravatar says:
    Thursday, 28 Jun, 2012 at 1:09 am

    This might be a bit easier-
     
    Install with both NICs attached, install the HyperV IC.
    Shutdown, remove the Legacy Adaptor, reboot.
    Modify /etc/sysconfig/network-scripts/ifcfg-eth0 to match the MAC of the full-speed NIC
    Modify /etc/udev/rules.d/70-persistent-net.rules as follows:
    The first device (usually "tulip", change the mac addr to match the full-speed NIC.
    Comment out the "SUBSYSTEM" line underneath.
    Save that file, and run this command:
    chattr +i /etc/udev/rules.d/70-persistent-net.rules
    Reboot. Fixed!

    Reply
    • RoarNo Gravatar says:
      Friday, 15 Feb, 2013 at 10:08 am

      Thanks Nick, that worked for me.  If you've persisted in getting eth0 to show up without the IC installed you probably end up where I did.  Install the IC (v3.4 for me) and follow Nick's guide.

      Reply
  7. Installation de Centos6 sous Hyperv ‹ Infos-reseau.com says:
    Monday, 20 Aug, 2012 at 2:28 am

    [...] me suis inspiré de cet article avec une ou 2 [...]

    Reply
  8. Questions regarding CentOs 6.3 install on HyperV Remote server says:
    Thursday, 11 Oct, 2012 at 5:43 am

    [...] following looks similar to your situation; http://www.pwrusr.com/system-adminis…ng-and-hyper-v Although, since I'm not "The Help," I don't do [...]

    Reply
  9. SohailNo Gravatar says:
    Thursday, 10 Jan, 2013 at 5:01 pm

    after going to this solution, my network is working..

    Reply
  10. SohailNo Gravatar says:
    Thursday, 10 Jan, 2013 at 5:03 pm

    you can simple make empty HWADDR field in /etc/sysconfig/network-Scripts/ifcfg-eth0,
    as
    HWADDR=

    Reply
  11. bazNo Gravatar says:
    Friday, 18 Jan, 2013 at 8:09 pm

    great great great! thanks!

    Reply

Leave a Reply

Click here to cancel reply.

 

Typography++ by Andrea Matesi design by Six Shooter Media Sponsored by Web Hosting Provider