#!/bin/sh

# Test if second NIC exists.
eth1_exists=`grep eth1 /proc/ioports|wc -l`

if [ $eth1_exists -eq 1 ]
then
	#
	# Double NIC configuration.
	#
	brctl addbr br0
	brctl addif br0 eth0
	brctl addif br0 eth1

	ifconfig eth0 0.0.0.0 up
	ifconfig eth1 0.0.0.0 up
	ifconfig br0 $1 netmask $2 up
else
	#
	# Single NIC configuration.
	#
	ifconfig eth0:1 down	# Break from router mode.
	ifconfig eth0 $1 netmask $2 up
fi

route add default gw $3
