Change IP address through the application software with ElinOS embedded Linux compressed File system .

Feb 17, 2005 7 Replies

Hello,


We have an application running on Kontron Dimm-PC/Lite-IE whit embedded Linux ELinOS.



We are working with a compressed rootfile system *.TGZ


To change the IP address we need to generate every time a new compressed file system,with



the right IP address inside. We are looking for a solution how to change the IP address through



our application, to make it easyer to change the IP address


I will be happy if anybody has a hint for us.


Kindest Regards


Nils Koehler


----------------------------------------------- Nils Köhler IBT Interfaces Im Taubhaus 19 63322 Rödermark Germany Tel: +49-6074-6964-160 Fax: +49-6074-6964-161

If the host network supports this, of course DHCP is the easiest way to provide an appropriate IP address to an embedded box.

Additional Hardware could be used: a serial flash or dip switches.

Maybe the Dimm-PC has a CMOS RAM or a parameter Flash for the BIOS. Here some bytes might be available.

You _could_ put the information in the BIOS code FLASH (if this is a separate device) but who would dare to recommend this ?

Additional to the compressed file system, the Linux boot information contains the Kernel command line. Supposedly it's easier to change this than the internals of a compressed file. I don't know how to request information off the Kernel command line from a user land program, but I do believe that this is possible, at least when writing a device driver for that purpose.

You could reserve an additional section in the flash Linux boots from and access same directly (e.g. as a memory location) with a device driver.

-Michael

cat /proc/cmdline

:-)

Rob

Robert Kaiser email: rkaiser AT sysgo DOT com SYSGO AG http://www.elinos.com Klein-Winternheim / Germany http://www.sysgo.com

Hi Michael,

Thank you for your answer,

it is not our problem to store the IP address on the target, we have allot of disk space.

DHCP is a good idea but our customer don't allow DHCP on his Network.

What we need to do is to change the ip address thought our software.

Ore there is any possibility by system commands I don't know?

But thanks for your time

"Michael Schnell" schrieb im Newsbeitrag news: snipped-for-privacy@viruswall.lumino.de...

Hi Rob,

with cat /proc/cmdline

I saw our onfiguration including the actual IP address, but how can I change and activate it without booting?

Nils

thank you for the cat /proc/cmdline "Robert Kaiser" schrieb im Newsbeitrag news:cv26mb$evp$02$ snipped-for-privacy@news.t-online.com...

Hi Nils Koehler, I make it in this way (You know the IP-address in cIPAdr, the netmask in cNetmask and maybe the default gateway in cGateWay):

------------- #include ... char cmd[128]; sprintf(cmd, "/sbin/ifconfig eth0 %s", cIPAdr); system(cmd); sprintf(cmd, "/sbin/ifconfig eth0 netmask %s", cNetmask); system(cmd); sprintf(cmd, "/sbin/route add default gw %s", cGateWay); system(cmd);

--------------

Hope this helps you, Juergen

silly

the ifconfig command.

Of course there also is an API call that is encapsulated in the standard library. Supposedly "man ifconfig" gives all necessary information.

-Michael

Thank you,

IT WORKS :-))

"Jürgen Querengässer" schrieb im Newsbeitrag news: snipped-for-privacy@>

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required