[gPXE] Static IP address setting in gPXE

何闯 justhechuang at 163.com
Wed Mar 30 21:42:36 EDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://etherboot.org/pipermail/gpxe/attachments/20110331/291cc319/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.jpg
Type: image/jpeg
Size: 79207 bytes
Desc: not available
URL: <http://etherboot.org/pipermail/gpxe/attachments/20110331/291cc319/attachment-0001.jpg>


More information about the gPXE mailing list