[gPXE] Static IP address setting in gPXE

何闯 justhechuang at 163.com
Wed Mar 30 22:31:44 EDT 2011


Thanks very much indeed!!!
At 2011-03-31,"Gene Cumm" <gene.cumm at gmail.com> wrote:
>2011/3/30 何闯 <justhechuang at 163.com>
>>
>> Dear all,
>> For some reason, I want to set a static IP address for my gPXE bootloader.
>> I first run a PXENV_GET_CACHED_INFO call in pxeprefix.S, and store the result in pxe_cached_dhcpack_data
>> then I coded such( dhcp call is replaced by it ):
>> ////////////////////////////////////BEGIN//////////////////////////////////////////////////////////
>>     struct settings *parent;
>>     union pxe_cached_info *info;
>>     struct dhcp_packet pxe_cached_dhcpack;
>>
>>     info = (union pxe_cached_info *)phys_to_user(__from_data16(&pxe_cached_dhcpack_data));
>>     info->dhcphdr.ciaddr= inet_addr("192.168.117.144");  //To set a static IP address for my bootloader
>>     parent = netdev_settings( netdev );
>>     dhcppkt_init( &pxe_cached_dhcpack,&info->dhcphdr, sizeof(*info));
>>    register_settings( &pxe_cached_dhcpack.settings, parent );
>> ////////////////////////////////////END/////////////////////////////////////////////////////////
>> However, when I call route command in gPXE shell,  it seems that the IP address for the netdev still remains unchanged.
>> see the picture:
>>
>> What's wrong is it?
>> yours,
>> soforth
>
>This can be done from a script and is probably more reliable.
>http://etherboot.org/wiki/scripting and
>http://etherboot.org/wiki/commandline should provide reference.
>
>Without an embedded script (
>http://etherboot.org/wiki/scripting#embedded_images ), gPXE normally
>executes autoboot ( http://etherboot.org/wiki/commandline#other ).
>
>--
>-Gene
>
>"No one ever says, 'I can't read that ASCII(plain text) e-mail you sent me.'"



More information about the gPXE mailing list