#!/bin/sh
#
# This will restart the network.
#
#                  $1   $2         $3      $4      $5
# restart_network mode ip_address netmask gateway sleep_time
#
#	-mode is "dhcp" or "anything else" (only dhcp is significant).
#	-ip_address, netmask, and gateway are dotted ip's.
#	-sleep_time is in seconds.
#
# Give the web page a chance to return.
sleep $5
# Kill dhcp client if it's running.
#killall udhcpc
# Bring interface down.
ifconfig eth0 down

# If using dhcp.
#if [ "$1" = "dhcp" ]
#then
	# (re)Start dhcp client.
#	udhcpc -i eth0 -b -p /var/run/udhcpc.eth0 >/dev/null 2>&1
#else
	# Restart interface.
#	ifconfig eth0 $2 netmask $3 up
	# Add gateway.
#	route add default gw $4 eth0
#fi

# Restart interface.
ifconfig eth0 $2 netmask $3 up

# And return.
exit 0
