Sorry, you need to enable JavaScript to visit this website.

change default ipaddr of MicroZed

Unsolved
5 posts / 0 new
kay's picture
kay
Junior(0)
change default ipaddr of MicroZed

The default IP address of MicroZed is 192.168.1.10, I know this could be changed by typing command: ifconfig eth0 ***.***.***.***. but I don't want this kind of configuration work every time i start my board!
I'm wondering is there any method to set my board a certain ip, say for example, 192.168.1.9? To make sure it won't go back to the 192.168.1.10 every time i restart it.
At first, I thought the ipaddr is set by U-boot.elf, so I rebuild it with modification in directory "/include/configs/zynq_common.h" where there is a Macro defination "CONFIG_IPADDR", however the change I made here is not helpful, after I loaded u-boot.elf into my board's SD card, and let my os ran again, the ifconfig still showed me "192.168.1.10"
What should I do? .>_<.

regaiegy's picture
regaiegy
Junior(0)
Did you check the interfaces file ?

You should be able to set your IP once and for all by modifying the content of your interfaces file </etc/network/interfaces>
the syntax is really easy.
You will just have to unpack the image, make your change then pack it once again.
Regards,
yreg

kay's picture
kay
Junior(0)
Checked, but really strange, there's no such a file originally

Thank you for your reply :)
I've checked the interfaces file in my system and found there's no such a file!
This time, for I'm using "uramdisk.image.gz" on my board, I striped it, unzipped it, added interfaces file under the path, then build it back again. However, when I ran the board again with the rebuilt file system, still no such a file! why? Where the "192.168.1.10" comes from?

I'm a freshman in this field, and really need you guys' help. Thank you in advance!

robertbrowder's picture
robertbrowder
Junior(0)
My solution

Kay

I am new to the microzed as well and needed the default netmask to be 255.255.0.0.

My somewhat hacked-up solution was to create a file /mnt/init.sh. This is the last thing executed in the boot up process. This file has only one line:

"ifconfig eth0 192.168.1.10 netmask 255.255.0.0"

There is probably a better way but this seemed to work for me.

kay's picture
kay
Junior(0)
Robertbrowder

Robertbrowder
Thank you, that works, init.sh is the file provided for customized initialization I guess. Just as what you put, this is the last thing executed in the boot up process, triggered by the last line "source /mnt/init.sh" in rcS file. I made changes by adding "ifconfig eth0 ***" in /etc/init.d/rcS, also works.
Best regards