How to set usb0 static IP during boot up

Hi,
I am using BeagleBoard Rev C3, running ubuntu 11.10.
`

uname -a

Linux localhost.localdomain 3.0.0-12-omap #20-Ubuntu Fri Oct 7 14:58:13 UTC 2011 armv7l armv7l armv7l GNU/Linux

`

My serial connection is me giving junk characters, so I set up the ssh through usb0. But the problem is, in order to set up a static usb0 IP, I am running this script each time after the boot up.

`
#/bin/sh
cd /lib/modules/3.0.0-12-omap/kernel/drivers/usb/gadget
sleep 2
modprobe g_ether host_addr=16:0F:15:5A:E1:21 dev_addr=16:0F:15:5A:E1:20
ifconfig usb0 192.168.2.100 netmask 255.255.255.0
ifconfig usb0 up
route add default gw 192.168.2.1
echo $ā€™\nIP has setup for usb0, IP: 192.168.2.100\nā€™

`

So I need help on two things.

  1. How could I do the IP settings automatically during start up.?
  2. The set IP is missing after few seconds. So I need to run the following command reset the IP again.

`

ifconfig usb0 192.168.2.100 netmask 255.255.255.0

`

How would I solve these issues?