Novell Home

Imaging a Client over a Second Network Card

Novell Cool Solutions: Trench
By Thorsten Mick

Digg This - Slashdot This

Posted: 3 Dec 2003
 

We use Dell Latitude C640 Notebook built in Port-Replicator, with a second Network Card. The problem is, Novell-Zen401 standard environment cannot activate the second Network Card over pxe-boot.

SOLUTION: I modified the network.s script from the linux.2 pxe file, so it works with two Network-Interfaces.

EXAMPLE

#network.s
#Sets up the network interface

checkiflaptop()
{
	if [ ! $PCMCIADETECTED ]
	then
	 	insmod -f $MODPATH/pcmcia/pcmcia_core.o > /dev/null 2>&1
		if [ $? != "0" ] ; then unset PCMCIADETECTED; return ; fi

		export PCMCIADETECTED=YES
	fi

	

	if [ ! $PCMCIACONTROLLER ]
	then
		insmod -f $MODPATH/pcmcia/i82365.o > /dev/null 2>&1
		if [ $? != "0" ]; then
			insmod -f $MODPATH/pcmcia/tcic.o > /dev/null 2>&1
			if [ $? != "0" ] ; then unset PCMCIACONTROLLER; return ; fi
			export PCMCIACONTROLLER=tcic
		else
			export PCMCIACONTROLLER=i82365
		fi
	fi

	if [ ! $DRIVERSERVICELOADED ]
	then
		insmod -f $MODPATH/pcmcia/ds.o > /dev/null 2>&1
		if [ $? != "0" ]; then unset DRIVERSERVICELOADED; return ; fi
		export DRIVERSERVICELOADED=YES
	fi

	cardmgr -o > /dev/null 2>&1

}

rmlaptopmodules()
{

	if [ $DRIVERSERVICELOADED ]
	then
		rmmod ds > /dev/null 2>&1
		unset DRIVERSERVICELOADED
	fi

	if  [ $PCMCIACONTROLLER ]
	then
		rmmod $PCMCIACONTROLLER > /dev/null 2>&1
		unset PCMCIACONTROLLER
	fi

	if [ $PCMCIADETECTED ]
	then
		rmmod pcmcia_core > /dev/null 2>&1
		unset PCMCIADETECTED
	fi

		
}


GetDHCPInfo()
{
      unset NWUNREACHABLE
	echo "Getting DHCP info from the server. Please Wait."
        echo "...on device = $NETDEVICE ($DRIVERNAME)"
	pump -h localhost.localdomain.com -i $NETDEVICE 
	if [ $? != "0" ]; then export NWUNREACHABLE=YES; fi
        if [ ! -f /etc/resolv.conf ] 
	then 
		if [ "a"$TRYDHCPCD = "aYES" ]
		then
			ifconfig $NETDEVICE up > /dev/null 2>&1
			dhcpcd $NETDEVICE 
			if [ ! -f /etc/resolv.conf ]
			then 
				echo "Unable to obtain IP address."
				export NWUNREACHABLE=YES
		        fi
                 fi
	 fi
}


DetectNetDevice()
{
	if [ "a"$NETDEVICE = "aeth0" ]
        then
                NETDEVICE="eth1"
        else
                NETDEVICE="eth0"
        fi 

	if cat /proc/pci | grep -q -i "token ring"
	then
		NETDEVICE="tr0"
	fi
	export NETDEVICE=$NETDEVICE
} 



BindDriver()
{
DetectNetDevice
unset DRIVERFOUND
ifconfig $NETDEVICE up > /dev/null 2>&1
if [ $? != "0" ] 
then
	checkiflaptop
	ifconfig $NETDEVICE up > /dev/null 2>&1
	if [ $? != "0" ]
        then 
		rmlaptopmodules

		#Read the nwdriverList to load the preferred list of drivers
		#This was essential because of machines where 3c90x and 3c59x both could be loaded
		#only 3c90x worked, so nwdriverList forces 3c90x to be loaded before 3c59x	

		#removed insmod with modprobe as it automatically loads all dependent modules
		#the dependency list is read from modules.dep file generated by depmod
		for file in $( cat /etc/nwdriverList 2>/dev/null ); do
			modprobe -a $file* > /dev/null 2>&1
			ifconfig $NETDEVICE up > /dev/null 2>&1
			if [ $? = "0" ]
			 then 
				DRIVERFOUND=YES
				export DRIVERNAME=$file
				break
			 fi
		done

		if [ ! $DRIVERFOUND ]
		then
		for file in $(ls $MODPATH/net 2> /dev/null ); do
			modprobe -a $file* > /dev/null 2>&1
			ifconfig $NETDEVICE up > /dev/null 2>&1
			if [ $? = "0" ]
			 then
				 DRIVERFOUND=YES
				 export DRIVERNAME=$file	
				 break
			 fi
		done
		fi
		if [ ! $DRIVERFOUND ]; then echo "Unable to detect network card. Check documentation for list of supported cards"; fi
	fi

fi
}

#script start
if [ ! $IPADDR ]
then
      BindDriver
      GetDHCPInfo
	if [ "a"$NWUNREACHABLE = "aYES" ]
        then
	   BindDriver
	   GetDHCPInfo
        fi

      ifconfig $NETDEVICE multicast > /dev/null 2>&1
	route add -net 224.0.0.0 netmask 240.0.0.0 dev $NETDEVICE > /dev/null 2>&1
else
	ifconfig $NETDEVICE $IPADDR netmask $NETMASK multicast > /dev/null 2>&1
	route add -net 224.0.0.0 netmask 240.0.0.0 dev $NETDEVICE > /dev/null 2>&1
	if [ $GATEWAY ]; then route add default gw $GATEWAY > /dev/null 2>&1; fi
	rm -f /etc/resolv.conf  > /dev/null 2>&1
	echo "search $DNSDOMAINSUFFIX" > /etc/resolv.conf
	for str in $DNSNAMESERVER; do echo "nameserver $str" >> /etc/resolv.conf; done
fi

echo Proxy IP Address is set to $PROXYADDR

If you have any questions you may contact Thorsten at thorsten.mick@keb.de


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

© 2014 Novell