Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: Evangelos on June 05, 2011, 05:37:09 PM

Title: Static ip/netmask/broadcast on switch (no router)
Post by: Evangelos on June 05, 2011, 05:37:09 PM
I have 3 machines on a switch. How can I give them ip/netmask and broadcast?
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: gerald_clark on June 05, 2011, 05:40:19 PM
Use the network setup button in the control panel.
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: Evangelos on June 05, 2011, 06:28:00 PM
OK thanks!

Do I have to insert something into the

/opt/bootlocal.sh

In order to keep my changes forever?

p.s. another question, why it says ping: unknown protocol icmp
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: Lee on June 05, 2011, 07:10:08 PM
Quote
p.s. another question, why it says ping: unknown protocol icmp

Oh, that's just to annoy users who think they know what they are doing.  :)

More seriously, one of the extensions is apparently superseding  the busybox ping command with a broken  version.

Code: [Select]
tc@apollo:~$ which ping
/usr/local/bin/ping
tc@apollo:~$  ping www.google.com
ping: unknown protocol icmp.
tc@apollo:~$
tc@apollo:~$
tc@apollo:~$
tc@apollo:~$ /bin/ping www.google.com
PING www.google.com (74.125.93.105): 56 data bytes
64 bytes from 74.125.93.105: seq=0 ttl=53 time=43.320 ms
64 bytes from 74.125.93.105: seq=1 ttl=53 time=43.587 ms
64 bytes from 74.125.93.105: seq=2 ttl=53 time=43.634 ms
^C
--- www.google.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 43.320/43.513/43.634 ms
tc@apollo:~$
tc@apollo:~$
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: Evangelos on June 05, 2011, 07:51:12 PM
Why everytime I reboot, I have to do again
the

ifconfig eth0 192.168.0.11 netmask 255.255.255.0 up

?

Is there any way to keep this IP ? can I put this command on a script to run on startup?
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: maro on June 05, 2011, 08:38:41 PM
As the appropriatey named "Run Commands during Startup or Shutdown" Wiki-page (http://wiki.tinycorelinux.net/wiki:bootlocal.sh_and_shutdown.sh) (and countless threads in this forum) explains: add your commands to '/opt/bootlocal.sh' (or '/opt/bootsync.sh') and ensure that you perform a backup before shutdown.

PS: A bit of searching through the Wiki pages and this forum is kind of expected before raising this sort of questions that one could expect that many others have asked before ...
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: Evangelos on June 05, 2011, 08:48:14 PM
I tried in two ways:

1) inserted ifconfig eth0 192.168.0.11 netmask 255.255.255.0 up in to the bootlocal.sh

2) insert /opt/eth0.sh with the ifconfig eth0 192.168.0.11 netmask 255.255.255.0 up
on bootlocal.sh to load on startup.

Everytime  I did backup but after the reboot, no eth0!!!only lo with the ifconfic command appear.
then the ifconfig eth0 192.168.0.11 netmask 255.255.255.0 up
worked, but I wanted on startup.
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: maro on June 05, 2011, 09:17:12 PM
Are you making sure that there is no DHCP client running when it comes to executing the 'ifconfig' command? What can be found when running the 'network' GUI tool (and saving it's configuration) is that the freshly created '/opt/eth0.sh' script first off kills the 'udhcpc' process. BTW, the same result could be achieved via the 'nodhcp' boot code.

Another thought is that (at least theoretically) the 'eth0' device might not be ready at the time the 'ifconfig' command gets executed. You might find that out by producing a 'dmesg' entry prior to the 'ifconfig' execution (e.g. by inserting echo 'Starting /opt/bootlocal.sh' > /dev/kmsg as the first command in '/opt/bootlocal.sh') and checking what 'eth0' related messages are showing up in the 'dmesg' output after this marker.



EDIT: Correction of a typo
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: Rich on June 05, 2011, 09:33:10 PM
Quote
Are you making sure that there is no DHCP client running when it comes to executing the 'ipconfig' command?

Didn't you mean  ifconfig ?
 
EDIT: Disregard this post, previous post corrected.
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: Juanito on June 05, 2011, 11:28:51 PM
p.s. another question, why it says ping: unknown protocol icmp

Because /etc/protocols is missing - there's a full version in the iana-etc extension or you can put something smaller yourself.
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: tinypoodle on June 06, 2011, 05:07:33 AM
Quote
Are you making sure that there is no DHCP client running when it comes to executing the 'ipconfig' command?

Didn't you mean  ifconfig ?
 

Out of my head 'ipconfig' would be the equivalent to 'ifconfig' on other operation system(s).
Title: Re: Static ip/netmask/broadcast on switch (no router)
Post by: Evangelos on June 06, 2011, 07:43:22 AM
I am going to connect my PCs directly to the router. because I think that I could not fix this problem.


thanks for all guys.