[sentinix-list] MTU

"Patrick Ambuhl" <[email protected]> Fri, 06 Feb 2004 14:40:12 +0100
Newsgroups gmane.linux.sentinix
Message-ID <[email protected]>
Hi,
I had to do a small modification to allow my MTU settings to be applied, if it can help somebody I attach the modified file, be aware that you need to add a line like SX_NETDEV_eth0_MTU=1492.

Regards

_______________________________________________
SENTINIX mailing list
[email protected]
http://elevenprospect.com/mailman/listinfo/sentinix
rc.inet1 (text/plain, 2 KB)
#!/bin/sh
TMP="/tmp/rc.inet1.temp"
rm -f $TMP

# set up the loopback interface:
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo

if [ ! -e /etc/NETCONFIG ]; then
    echo -ne "\033[1;31mCan't configure network devices, /etc/NETCONFIG is missing"!
    echo -e "\033[0m"
    exit 1
fi

# first, get the variables from /etc/NETCONFIG:

echo -n "" > $TMP
chmod 0700 $TMP
cat /etc/NETCONFIG | while read LINE
do
    echo "export $LINE" >> $TMP
done

# execute the tempfile with new "export" prefix
. $TMP
# ...and remove it.
rm -f $TMP

cat /etc/ETHERNETS 2> /dev/null | while read ETH
do
    IP=`printenv SX_NETDEV_${ETH}_IP`
    NETMASK=`printenv SX_NETDEV_${ETH}_NETMASK`
    MTU=`printenv SX_NETDEV_${ETH}_MTU`

	if [ "$IP" = "dhcp" -o "$IP" = "DHCP" -o "$IP" = "Dhcp" ]; then
		echo -e "\033[1mConfiguring ${ETH} by contacting a DHCP server...\033[0m"
		/usr/sbin/dhcpcd -N -t 10 -d ${ETH}
		if [ $? -eq 0 ]; then
			sleep 1
	    		IP=`ifconfig ${ETH} 2> /dev/null | grep "inet addr:" | cut -d: -f2 | cut -d' ' -f1`
			hostsfile=`cat /etc/hosts 2> /dev/null`
			echo "$hostsfile" | grep -v "`cat /etc/HOSTNAME` `cat /etc/HOSTNAME | cut -d. -f1`" > /etc/hosts
			echo "${IP}	`cat /etc/HOSTNAME` `cat /etc/HOSTNAME | cut -d. -f1`" >> /etc/hosts
		fi
	elif [ ! "$IP" = "" -a ! "$NETMASK" = "" ]; then
		BROADCAST=`/bin/ipmask $NETMASK $IP | cut -f1 '-d '`
		NETWORK=`/bin/ipmask $NETMASK $IP | cut -f2 '-d '`
		echo -e "\033[1mConfiguring ${ETH} with IP ${IP} , netmask ${NETMASK} and mtu ${MTU}...\033[0m"
		/sbin/ifconfig ${ETH} ${IP} broadcast ${BROADCAST} netmask ${NETMASK} mtu ${MTU}
		hostsfile=`cat /etc/hosts 2> /dev/null`
		echo "$hostsfile" | grep -v "`cat /etc/HOSTNAME` `cat /etc/HOSTNAME | cut -d. -f1`" > /etc/hosts
		echo "${IP}	`cat /etc/HOSTNAME` `cat /etc/HOSTNAME | cut -d. -f1`" >> /etc/hosts
	fi
done

if [ ! "${SX_GATEWAY}" = "127.0.0.1" -a ! "${SX_GATEWAY}" = "" ]; then
	echo -e "\033[1mDefault gateway is ${SX_GATEWAY}.\033[0m"
	/sbin/route add default gw ${SX_GATEWAY} metric 1
fi