Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: nsqtr on September 12, 2009, 09:05:17 PM
-
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
-
Create a file named eth0.sh
EX:
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
Then add "/opt/eth0.sh &" to bootlocal.sh
and add "opt/eth0.sh" to .filetool.lst
-
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?
-
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.
-
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?
-
I guess one way of doing it would be to pass the nodhcp boot code and then handle the two interfaces in my bootlocal.sh; i.e., fire up dhcp on eth0 and static route on eth1 overtly
-
perhaps the nodhcp bootcode should be modified to require a list of device names for the nodhcp to apply; e.g.
nodhcp=eth1,ath0
and, in this case, eth0 would be dhcp-enabled.
if the list were empty (i.e. no "=" or thereafter), the nodhcp bootcode would work as now.
-
For your special case, I think booting with nohdcp and handling in /opt/bootlocal.sh is more appropriate.