Tiny Core Base > TCB Q&A Forum

simplest way to establish a static IPADDR for an interface?

(1/2) > >>

nsqtr:
I'm using microcore 2.3 and see that the DHCP init script has been changed to ignore already-configured net interfaces.  I want to set eth0 to a static IPADDR and am not sure of the simplest/best way to do so.  Without experimenting, it seems like bootlocal.sh would be too late in the process.  Is there something in /etc/sysconfig that I'm missing?   

thanks for any help

gerald_clark:
Create a file named eth0.sh
EX:

--- Code: ---pkill udhcpc
ifconfig eth0 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 up
route add default gw 192.168.1.254
echo nameserver 192.168.1.1 > /etc/resolv.conf

--- End code ---

Then add "/opt/eth0.sh &" to bootlocal.sh
and add "opt/eth0.sh" to .filetool.lst

nsqtr:
thanks, but I don't want to kill udhcpc. I'm dual-homed and want eth1 to still be a dhcp client, while eth0 has a static ipaddr. So, is an eth0.sh script going to be too late in the boot process to establish a static IPADDR for eth0?

roberts:
Should be fine. You can also use the GUI tool netcardconfig in the control panel and then edit check the eth0.sh that it creates.

nsqtr:
I call eth1.sh near the bottom of my bootlocal.sh, which contains:

ifconfig eth1 10.10.10.1 netmask 255.255.255.0 broadcast 10.10.10.255 up
route add -net 10.10.10.0/24 gw 10.10.10.1 eth1

ifconfig eth1 shows me the static assignment.

However, ps -ef shows me that there is an /sbin/udhcpc -b -i eth1 .... etc.etc

process running.  The lease timeout hasn't occurred yet but I wonder if, when the lease expires, the dhcpc daemon will overwrite my static IPADDR for eth1.

Even if it doesn't, I've got a udhcpc process running, which I guess I could kill inside of bootlocal.sh via a spin loop waiting for the udhcpc process to come up.

Any thoughts on a better way?

Navigation

[0] Message Index

[#] Next page

Go to full version