Interface with DHCP - purpose of "Alias IP Address" field?



  • When configuring an interface to use DHCP, I've been unable to work out what the "Alias IP address" field is for.
    Its description is "The value in this field is used as a fixed alias IP address by the DHCP client.", but this doesn't mean a lot to me.

    Could someone explain what the field is for? (Comparing it to my current main installation doesn't help as 1.2.3 doesn't ask for this)

    Cheers :)

    Wasn't sure if this was the right forum, but it is about a 2.0-only field…



  • perhabs an alternativ static ip if the dhcp does not work?



  • After going through some source code and finding this in /etc/inc/interfaces.inc: ($wancfg['alias-address'] is the IP Alias variable):

    if(is_ipaddr($wancfg['alias-address'])) {
    	$subnetmask = gen_subnet_mask($wancfg['alias-subnet']);
    	$dhclientconf .= <<<eod<br>alias {
    	interface  "{$wanif}";
    	fixed-address {$wancfg['alias-address']};
    	option subnet-mask {$subnetmask};
    }
    
    EOD;
    }</eod<br>
    

    I looked up what "fixed-address" actually does in dhclient.conf:

    fixed-address ip-address;
    The fixed-address statement is used to set the ip address of a particular lease. This is required for all lease statements. The IP address must be specified as a dotted quad (e.g., 12.34.56.78).

    That doesn't tell me what you're supposed to write in that field.

    (Also, on a network where you're asking a DHCP server for an IP address, subnet mask, gateway and other such information, why would you have to specify an IP address… that defeats the purpose of DHCP... doesn't it? ???)



  • My "guess" is that this could be used when using a CARP setup where you have a cluster of boxes running pfSense. The alias would be the Virtual IP of the cluster and not just the actual IP of the specific box that you are configuring. I've no idea if that's the reason but that's my guess. Don't have a 2.0 box to test yet so I can't look.



  • Don't put anything there. Sometimes you need an IP alias in addition to a DHCP lease, that's its purpose, it should virtually always be left blank.



  • Aha, thanks cmb :)

    Perhaps the text should be made non-bold? - I had assumed the field was required as it is bold ;)



  • @Fr3d:

    Perhaps the text should be made non-bold? - I had assumed the field was required as it is bold ;)

    Ah yes, I had overlooked that. I just fixed it.



  • Ah, I misread that this was for the DHCP client and that led me to the erroneous guess.

    So is Velociraptor correct?
    @Velociraptor:

    perhabs an alternativ static ip if the dhcp does not work?



  • @focalguy:

    So is Velociraptor correct?
    @Velociraptor:

    perhabs an alternativ static ip if the dhcp does not work?

    After further Googling, it would appear that that field is indeed for assigning a static IP in the event a DHCP server cannot be contacted.

    The manpage for dhclient.conf says that a value is required, however I assume that if you don't provide a value, it will simply not assign any IP address to the interface in the event it cannot contact a DHCP server.

    Windows' DHCP client does a similar thing; it assigns an IP in the 169.254.0.0/16 range if it cannot contact a DHCP server, unless you've used the "alternate configuration" tab to specify one yourself.



  • nice info. thanks much!



  • Yes, thanks for the info Fr3d! Learn something new every day. Who knows, maybe that will come in useful for me someday!


Log in to reply