Jump to content

Renaming seth0 to eth0 in ClearOS


Leon
 Share

Recommended Posts

  • Administrators

I was using ClearOS 5.2, but I believe these steps will probably also work for ClearOS 5.1?

 

A couple things to keep in mind about my notes.

 

a) I had ClearOS setup as a gateway with two NICs. Due to other VMs on Hyper-V I am using eth0 as the LAN and eth1 as the WAN. ClearOS seems to default to the reverse and if you followed that convention you'll need to reverse some of the things I'll document below.

 

B) For my notes below I did this from a fresh install of ClearOS 5.2. If you've already been using ClearOS for a while you may need to do things a little differently than what I'm describing here. In general you want all the configurations I mention to have "ethX" instead of "sethX" with the exception of /etc/iftab

 

c) If you see "sethX" during the boot process then you're missing one of these configuration steps.

 

d) I used the Microsoft Version 2.1 Release Candidate driver as I have a 4 CPU system. In using the current Microsoft Version 2.0 driver my system hung during the boot process. I found that by changing the Hyper-V configuration to 1 virtual CPU the boot completed. If you would rather only use non-Beta code I believe that in using a single CPU the other steps I mention here should all work for you.

 

e) There are several places in which the Ethernet Hardware (MAC) address is specified. I don't know what restrictions there are (if any) for Ethernet specs, Hyper-V, and/or Linux on valid MAC addresses. Keep in mind that whatever value you choose it needs to be unique in your network. Other than that I believe that any value from 0x000000000000 to 0xFFFFFFFFFFFF should work? You'll also need to ensure that the same value is used in the two or three places it must be specified. (I coded it in the ifcfg-XXX files, but it may not be absolutely necessary to include it there?)

 

f) In researching my problems I was reminded that Linux doesn't necessarily activate hardware devices in the same order each time. Thus it might be possible for eth0 and eth1 to be physically reversed from one boot to another. I don't know if that could be an issue with ClearOS or not? But I suspect the fact that the MAC address is specified should ensure that eth0 and eth1 are always the same physical interface from one boot to another?

 

g) Before following these steps you'll want to install ClearOS and get it working on Hyper-V. Verify that all your IP addresses are working, i.e., PING them from another host. And verify that all other software is functioning correctly. I believe it is better to be current on maintenance. So I'd also recommend that you update all software, both to ClearOS and Hyper-V, before trying to install this Microsoft driver.

 

h) Of course be sure you backup any critical data before attempting this. Just in case something goes wrong. In trying to find the best way to install and configure everything I had one erroneous variation in which neither NIC came up and I had trouble stopping the ClearOS boot process to try and get into a terminal session. I ended up re-installing ClearOS and starting over as I couldn't connect through the web interface on the Hyper-V console for this ClearOS VM.

 

i) One IMPORTANT POINT to keep in mind is that because you're making changes to the Ethernet configuration you probably won't be able to connect to the VM from outside with something like PuTTY. You'll need to use a remote connection to the Hyper-V console and use that terminal to make these changes.

 

j) I tried several variations to the process, but I couldn't find any way to install the driver and make all the configuration changes and just re-boot once. Because you have to make hardware changes to the Hyper-V NICs it appears that you need to boot once after the driver is installed and with the new (synthetic) NICs. Then make the configuration changes and boot a second time at which point everything should be working normally.

 

k) I'm not a Linux guru, but it appears to me that whatever ifcfg-XXXX files are found by Linux it attempts to start these interfaces. There also seem to be several variations on how these configuration files can be coded. I saw it coded both with and without double quotes around the various parameters. Various ClearOS scripts seemed to make modifications to these files. I tried a number of options before finding this method that worked, but in doing so I may have added some options to this file that ClearOS would not have on its own. I don't know if that could cause any problems for ClearOS or not? But if you have trouble afterwards you might want to see if you are missing any parameters the original ifcfg-XXX files originally had in them or if you've added any parameters that they didn't have. (Or perhaps used a different syntax than what was there before.)

 

Since my steps below are from a clean install I didn't have an existing ifcfg-XXXX file, but you might want to make a backup copy of the files you have first. Something in the process of trying to configure the system would wipe out those files and a backup will help to ensure you get back to your prior (working) network configuration. These are located in the directory /etc/sysconfig/network-scripts

 

ifcfg-eth0 -

 

DEVICE=eth0

TYPE=”Ethernet”

ONBOOT=”yes”

USERCTL=”no”

HWADDR=”00:15:5d:01:76:a2”

BOOTPROTO=”static”

IPADDR=”192.168.2.5”

NETMASK=”255.255.255.0”

GATEWAY=”192.168.7.1”

 

ifcfg-eth1 -

 

DEVICE=eth1

TYPE=”Ethernet”

ONBOOT=”yes”

USERCTL=”no”

HWADDR=”00:15:5d:01:76:a3”

BOOTPROTO=”static”

IPADDR=”192.168.7.5”

NETMASK=”255.255.255.0”

GATEWAY=”192.168.7.1”

 

Here are the steps I took to get this Microsoft driver working. With some slight variations these first steps I believe are common to any derivative of Red Hat? Prior to executing these steps you'll want to modify Hyper-V to have the Microsoft driver ISO file in the virtual DVD drive.

 

yum groupinstall "Development Tools"

yum update (Get current on maintenance)

mkdir -p /mnt/cdrom

mount /dev/cdrom /mnt/cdrom

cp -rp /mnt/cdrom /opt/linux_ic

umount /mnt/cdrom

cd /opt/linux_ic

./setup.pl drivers

 

If the Microsoft driver setup runs correctly you should get something like this for your result.

 

# ./setup.pl drivers

Checking if required components are installed...done.

Installing Linux integration components (vmbus, enlightened ide, enlightened scsi and network drivers) for Hyper-V...

Building all modules...

Building modules, stage 2.

done.

Your system supports the timesource driver, including driver in the build

Installing vmbus driver...done.

Installing netvsc driver...done.

Installing storvsc driver...done.

Installing blkvsc driver...done.

Installing hv_timesource driver...done.

Updating module dependencies. This may take a while...done.

Installing various udev rules and scripts...done.

Updating initrd image...

Backing up /boot/initrd-2.6.18-194.8.1.v5.img to /boot/initrd-2.6.18-194.8.1.v5.img.backup0

Done. Updated /boot/initrd-2.6.18-194.8.1.v5.img

Updating grub conf file...

Done.

Installing vmbus startup script...

*** The drivers have been installed successfully.*** [ OK ]

 

To continue ...

 

# lsmod | grep vsc (This verifies that the Microsoft drivers loaded. My result is shown below.)

 

storvsc 33700 0

vmbus 52168 1 storvsc

scsi_mod 141908 8 storvsc,ib_iser,iscsi_tcp,libiscsi2,scsi_transport_iscsi2,scsi_dh,libata,sd_mod

 

shutdown –h now

 

At this point you need to modify the Hyper-V configuration. Remove the Microsoft driver from the virtual DVD drive. Delete your existing Legacy Network cards and add back in a "Network Adapter," i.e., the synthetic NIC that the Microsoft driver will communicate with. Specify a static MAC address. Once that is done boot the ClearOS VM.

 

If you're doing this from a clean install of ClearOS no ethX or sethX message should show up during this boot. If you get any sethX messages ClearOS is likely to say FAILED. But once you've made the following configuration changes everything and booted the VM a second time then everything should be working.

 

cd /etc/sysconfig/network-scripts

 

You'll need the ifcfg-ethX files. Depending upon the exact steps you follow you may have both ifcfg-ethX and ifcfg-sethX files. If so the sethX files can be deleted. Use nano to edit the ifcfg-ethX (an example configuration is shown above) and ensure that this configuration matches your network, i.e., correct IP address, router (gateway) address, hardware (MAC) addresses, etc. If you only have ifcfg-sethX files rename them to ifcfg-ethX and then modify them as appropriate (see example above).

 

cd /etc/init.d

nano ifrename

 

This newly created file should contain the following:

 

ifrename -i seth0 -n eth0

ifrename -i seth1 -n eth1

 

chmod 755 ifrename (make the ifrename file executable)

 

I don't know a lot about the Linux boot process, but basically this next command creates a link that is picked up at the appropriate time in the boot process to rename the sethX interfaces (which are created due to installing the Microsoft driver) to ethX which is something that the ClearOS system will recognize. Without doing this a number of the ClearOS webpages were not functioning correctly (see my prior post).

 

ln -s /etc/rc.d/init.d/ifrename /etc/rc.d/rc5.d/S09ifrename

 

cd /etc

nano iftab

 

This newly created file should contain the following. This is the only place in your configuration where you should have sethX instead of the more usual ethX. This is one of three places in which the Ethernet hardware (MAC) address is specified. (The other two are in the Hyper-V virtual NIC configuration and in the ifcfg-ethX files.)

 

# LAN Interface

seth0 mac 00:15:5D:01:76:A2

 

# WAN Interface

seth1 mac 00:15:5D:01:76:A3

 

cd /etc/init.d

nano network

 

CNTL-W to find VLAN (This is a nano search command to jump to the right place in this file.)

 

You should see the following in this "network" file -

 

# Even if VLAN is configured, without the utility we can't do much

[ ! -x /sbin/vconfig ] && VLAN=

 

Just below this point, i.e., after the equals sign, you'll want to add the following code.

 

if [ -x /sbin/ifrename ] && [ -r /etc/iftab ]; then

echo -n "Remapping network interfaces name: "

ifrename -p

echo "done."

fi

 

If you've done a fresh install of ClearOS at this point you should be able to reboot and everything should be working. If you've been running ClearOS for a while there is one other thing you should double check to ensure the firewall is configured correctly. If the firewall is not configured correctly you'll not be able to PING from an outside host and from inside the VM you'll get an error message (see my prior post). (Since it doesn't take long to check the firewall configuration you may want to do this even if you've performed a clean install.)

 

cd /etc

nano firewall

 

Verify the following is coded. In some cases something in a ClearOS script seemed to be clearing these values to "". On one occasion something I did caused a ClearOS script to fill in sethX instead of ethX.

 

EXTIT=”eth0”

LANIF=”eth1”

 

This next command (shutdown) will reboot your ClearOS VM. During the boot process you should see some messages (such as VMBUS) which are related to the Microsoft drivers. You should also see eth0 (and if you've got a gateway eth1) as OK during the boot process. If you see sethX one of the above configuration steps was somehow missed. After you correct it and reboot everything should be working.

 

Once the Microsoft driver is installed one benefit you'll see is that from the Hyper-V manager you can click the "Shutdown" button and instead of getting an error dialogue box back after a few minutes you'll see that ClearOS VM is shutting down gracefully.

 

shutdown –r now

 

In a prior post I mentioned getting the error message, "Remapping network interfaces name: Warning: interface name is 'eth0' at line 2, can't be mapped reliably" This was occurring because I incorrectly coded ethX in the iftab file rather than sethX.

 

Enjoy.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...