Novell is now a part of Micro Focus

Changing NIC Settings for ZENworks Imaging

Novell Cool Solutions: Tip
By William C Schneider

Digg This - Slashdot This

Posted: 18 Oct 2006

When using ZENworks Imaging the imaging kernel comes up with the NIC configured for auto-negotiate. If your switch port is hard coded, this conflict causes imaging to take considerably longer. In order to resolve this you can use ethtool to change the settings on the interface. Of course this takes a few minutes to type and it would be way cooler to create a script to do this. So I did!


Part of this is excerpted from the ZENworks documentation. Start by getting the root image mounted so we can add to it.

  1. Using a Linux machine, create a working directory and change to that directory.
    I created /media/iso
  2. To copy root from the PXE server to the new working directory:
    copy \tftp\boot\root to a directory on the Linux machine
    I copied mine to /var/tmp/zen
  3. To rename root to root.gz, enter:
    mv root root.gz
  4. To unzip the root.gz file, enter:
    gunzip root.gz
  5. To mount the root file system to the directory from step one, enter:
    mount -o loop root /media/iso

Now we need to put our script into the kernel. I chose to create a /usr/local/bin directory for the script to live in (in case I want to add more personalized stuff later).

  1. cd /media/iso/usr
  2. mkdir local/bin
  3. cd local/bin
  4. vi <name you want to use>
    I chose to use "setfull" as my command.
  5. Paste the following script in to vi:
    #This script sets the NIC to 100/full
    #Author W.Schneider 10-10-2006
    echo -e '\E[31;40m----------------------------------------------\E[37;40m'
    echo -e '\E[31;40mInitial Settings\E[37;40m'
    /usr/sbin/ethtool eth0 | egrep "Advertised auto-neg|Speed|Duplex|Auto-negotiation:"
    /usr/sbin/ethtool -s eth0 autoneg off
    /usr/sbin/ethtool -s eth0 duplex full
    /usr/sbin/ethtool -s eth0 speed 100
    echo -e '\E[31;40m----------------------------------------------\E[37;40m'
    echo -e '\E[32;40m----------------------------------------------\E[37;40m'
    echo -e '\E[32;40mChanged Settings\E[37;40m'
    /usr/sbin/ethtool eth0 | egrep "Advertised auto-neg|Speed|Duplex|Auto-negotiation:"
    echo -e '\E[32;40m----------------------------------------------\E[37;40m'
  6. Save the file (type ESC, hold shift and press ZZ)
  7. Now make the file executable using chmod
    chmod 755 setfull
  8. Now we need to edit the path variable so that our new directory is in the executable path.
    vi /media/iso/etc/bash.bashrc
    append the new directory to the export statement as follows:
    export PATH=/sbin:/bin:/usr/bin:/usr/sbin:/usr/local/bin
  9. Save this file.
  10. To unmount the root file system first change to a different directory
    cd /var/tmp/zen
    umount /media/iso
  11. Now we need to zip the filesystem back up
    gzip –v9c root > root.gz
  12. Rename the file
    mv root.gz root

Now just copy the file back to your tftp directory and you are done!

To use this, after you get to the bash prompt simply type the name of your script. The output should look like this:

If you have any questions you may contact William. Click on his author name under the title of this article, and scroll to the bottom of his list of contributions where there is a "Contact this Author" box.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates