# Static IP and alias IP provided by DHCP on same interface?



## jem (Aug 18, 2017)

Hello,

Can anyone tell me if it's possible to configure an interface with a static IP address, and have a DHCP client configure a second IP address as an alias, without replacing the static one?

I have a VDSL modem directly connected to my FreeBSD gateway.  It has a web admin UI on IP address 192.168.2.1 so I want to give my gateway host the static address 192.168.2.2 so that I can connect to the web UI.

However, the modem also functions as an ethernet to VDSL bridge, so I need to run a DHCP client on the gateway host to obtain a public IP address from my ISP.

Is this possible?

Thanks.
JM

EDIT: I know this is an ancient post, so hopefully this edit won't bump it, but I recently found a solution to the question I asked and thought it would be useful for anyone searching for the same thing.

dhclient.conf(5) now has an alias directive that can be used to assign a static IP to an interface alongside the one obtained through DHCP.  This might be a new thing that didn't exist 11 months ago.

```
interface "em0" {
}

alias {
  interface "em0";
  fixed-address 192.168.1.2;
  option subnet-mask 255.255.255.0;
}
```


----------



## SirDice (Aug 18, 2017)

My cable modem does something similar. It has an 192.168.100.1 address but it's in bridge mode. So the machine that's connected to it only has my "external" address. However, I'm still able to connect to it on the 192.168.100.1 address even when the interface doesn't have an address in that range.


----------

