VMware Cloud Community
fncpse
Contributor
Contributor

Customization script vCenter 5.5 adding extra lines in ifcfg-eth0

When I try to deploy a vm from a template and use the customization script, the vm will build, but my eth0 will have extra information in it, which is causing a slow down when trying to log in to the box via ssh.

Log in can take about 1 minute, once I remove those extra lines starting at the "check_link_down()" my login's will be normal speed and everything works just fine.  So the question is where is this being added from?, and how do I get it to stop so that I don't have to manually change every VM I build?

This is on a CentOS 6.5, Scientific Linux 6 and RHEL 6, all have the same issue.

DEVICE=eth0

ONBOOT=yes

USERCTL=no

BOOTPROTO=static

NETMASK=255.255.252.0

IPADDR=XXX.XXX.XXX.65

PEERDNS=no

check_link_down() {        <------  This is the information being added by the customization script

return 1;

}

0 Kudos
15 Replies
aneverov
VMware Employee
VMware Employee

Hi,

This is added by one of our scripts called RedHatCustomization.pm which you can find in one of the vCenter's subfolders. The comment says that it's a workaround for 'Vlance' NICs. It's hard to guarantee though that all other NIC types don't require this.

Best Regards,

Andrii

/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */
0 Kudos
fncpse
Contributor
Contributor

I see in the script:

# insert the check link fix for vlance card

   push (@content, "\ncheck_link_down() {\n return 1; \n}\n" );

/usr/lib/vmware-vpx/imgcust/linux/imgcust-scripts/RedHatCustomization.pm

This fits as far as the information that is being added to the ifcfg-eth0 file.  But doesn't help in the since I still have to manually remove this information in order to get login's to work correctly. The script is adding information to the ifcfg-eth0 file that is causing problems with login's.

Would commenting out this line fix this problem?  I see a science experiment in the future :smileysilly:

0 Kudos
fncpse
Contributor
Contributor

Looking at the script more, to me it would seem that there is a "if" statement missing.  The way it's written now it will just do the push regard less.

0 Kudos
fncpse
Contributor
Contributor

is there any way to run my own after post-install scripts to further customize the OS? in order to get around this problem?

0 Kudos
aneverov
VMware Employee
VMware Employee

Commenting/removing this line would exclude it from the generated ifcfg-eth0. However, please keep in mind that editing these files is not something we officially support, so it's at your own risk. As I mentioned, something else might stop working. I'm just answering your question about where does the line come from and why we need it.

Best Regards,

Andrii

/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */
0 Kudos
fncpse
Contributor
Contributor

I fully understand, and thank you for providing me the information. I don't want to make any changes to these files either, any changes I would make I would also undo to make sure it was back to the way it was before our experiment.

0 Kudos
aneverov
VMware Employee
VMware Employee

> is there any way to run my own after post-install scripts to further customize the OS? in order to get around this problem?

Not as part of guest customization in vCenter. We have that functionality in vCloud Director. It's implemented by hooking into rc.d or services. However, registering something like that in this case should be done in a way that it runs before the OS networking starts (possibly using "run levels", etc.).

Best Regards,

Andrii

/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */
0 Kudos
fncpse
Contributor
Contributor

I see this article

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=100180...

Since we are not using vlance, I don't see any issue, we are using vmware tools which installs the VMXNET 3 drivers.

0 Kudos
aneverov
VMware Employee
VMware Employee

Actually, I just found another article VMware KB: Getting a DHCP address in a Red Hat Enterprise Linux, Red Hat Linux 9.0, or Red Hat Advan... which also requires this line in some other cases.

/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */
0 Kudos
fncpse
Contributor
Contributor

All of those listed OS are old, so it shouldn't be an issue with us using RHEL 6.

0 Kudos
fncpse
Contributor
Contributor

So, I made some changes to the customization script and the extra lines are no longer appearing in my ifcfg-eth0 file.  But I still have a problem with slow logins after the creation of the VM.  Once I make some manual changes to the ifcfg-eth0 file, logins work properly.

Message was edited by: fncpse

0 Kudos
aneverov
VMware Employee
VMware Employee

Originally you mentioned that removing check_link_down helped. What kind of other changes do you make to speed up the logins? Could you please post you final ifcfg-eth0 which doesn't cause the slowdown?

/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */
0 Kudos
fncpse
Contributor
Contributor

after a customization and my VM is built.  Here is the ifcfg-eth0 output:

DEVICE=eth0

ONBOOT=yes

USERCTL=no

BOOTPROTO=static

NETMASK=255.255.252.0

IPADDR=XXX.XXX.XXX.155

PEERDNS=no

after I make my changes, and this is what it should look like as if I didn't make a customization to the VM

DEVICE=eth0    <---Change made here

TYPE=Ethernet

ONBOOT=yes

NM_CONTROLLED=no

BOOTPROTO=none

IPADDR=XXX.XXX.XXX.155  

PREFIX=22  <--- Add this

GATEWAY=XXX.XXX.XXX.254

DNS1=XXX.XXX.XXX.XXX

DNS2=XXX.XXX.XXX.XXX

DOMAIN="some_domain.net.local some_domain_name.com"

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="System eth0"   <---Change made here

Prior to the template being made.  I change the ifcfg-eth0 to eth5 and remove the UUID and HW Mac Address.  Delete the /etc/udev/rules/70-persistent-net.rules files, shutdown the VM and create the template from there.  This way any vm created will have a eth0 and not some other number.

# cd /etc/udev/rules.d

# cp 70-persistent-net.rules /root/

# rm 70-persistent-net.rules

# reboot

0 Kudos
aneverov
VMware Employee
VMware Employee

The only workaround I can suggest at this point is to hook up into rc.d/services and add missing values from there.

One could say that we should have considered changing only what's required instead of overriding the entire file with our own values. However, we can't really do that because NIC names may easily change (especially in multi-NIC situations and also when persistent-net.rules are not correct for some reason), so we won't be able to figure out the mappings and what ifcfg file to read from in all cases.

Exposing all this stuff in the UI/API is also not really an option, because it would become very cluttered and not everyone would want to fill all this stuff in causing a big problem of finding defaults which would also be different on different distros/versions.

We do have some ideas how to substantially improve user experience in such cases, but I can't tell when exactly that would be available.

/* Please remember to mark answer as 'helpful' or 'correct' such that other users know it can be used and people focusing on ‘unanswered’ questions can skip it. */
0 Kudos
dvmiller
Contributor
Contributor

I know this is an older thread; I found it while looking for something else.  If the ifcfg-eth0 contents you posted are the complete files, your ssh logins are probably slow due to missing DNS configuration, not by anything added by the customization scripts.  The default sshd configuration does a forward and reverse DNS lookup on all incoming connections.  That takes a minute or so to time out.

0 Kudos