# static ip address (alias) and dhcp at the same ethernet adap

## toralf

From my bug report https://bugs.gentoo.org/show_bug.cgi?id=121468 *Quote:*   

> 
> 
> Hhm, defining
> 
> ```
> ...

 

Unfortunatly I didn't understand the answer https://bugs.gentoo.org/show_bug.cgi?id=121468#c1 and it is neither an answer to my question nor to the problem, isn't it ? Might be I am a littlebit  stupid but anyway - can anybody give me an answer ?

It seems that a failed dhcp request destroys a working route.

----------

## magic919

The reply suggests you define the IP for the interface using fallback.  Are you saying that doesn't work either?

----------

## JeliJami

they probably mean fallback_eth0, as described in

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=2

----------

## suicidal_orange_II

Not the correct way (which used to be mentioned in /etc/conf.d/net.example) but as i read it you want 1 adapter to have a static ip and a dhcp one, to do this add 

```
ifconfig eth0:1 192.168.0.254 up
```

 to /etc/conf.d/local.start (make the file if it doesnt exist) and 

```
rc-update add local default
```

 to run it on every boot.

Hope im reading it right  :Smile: 

EDIT: forgot to say remove the static IP from /etc/conf.d/net and just leave the dhcp line

----------

## toralf

 *davjel wrote:*   

> they probably mean fallback_eth0, as described in
> 
> http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=2

 I don't want a static fallback address, I want a static address all the time and in addition a dhcp address if dhcp is available.

@suicidal_orange_II

sounds good, but I want the network to be recogniced as "up and running" in the sense of the gentoo rc-scripts

- And in fact, it works defining "dhcp" before "192.168.0.254/24", but why not if I define the alias before dhcp ?, that's my question.

----------

## UberLord

 *toralf wrote:*   

> why not if I define the alias before dhcp ?, that's my question.

 

Because DHCP clients normally erase configured addresses before adding their own.

----------

