# eth0 by DHCP, eth0:1 by static and working with wicd

## comcon1

Good morning, dear friends!

I have wicd and I want to save it to be able to connect wifi selecting the network. But also I have ethernet interface. Is it possible to make eth0 and eth0:1 in this configuration? I want to bind one interface to 192.168.112.* through one gateway and another interface should get IP by DHCP (it is in another subnet). Is it possible to do it with saving wicd? Or how I should do?

Thanks before!

----------

## charles17

No clue regarding wicd, sorry.  Did you check https://wiki.gentoo.org/wiki/Dhcpcd#Static_IP_addresses?

----------

## comcon1

And what is a basic decision without wicd?

 *charles17 wrote:*   

> No clue regarding wicd, sorry.  Did you check https://wiki.gentoo.org/wiki/Dhcpcd#Static_IP_addresses?

 

----------

## charles17

 *comcon1 wrote:*   

> And what is a basic decision without wicd?

 

It's up to you.  What I use is this approach with net-misc/netifrc banned from my system.

----------

## comcon1

 *charles17 wrote:*   

>  *comcon1 wrote:*   And what is a basic decision without wicd? 
> 
> It's up to you.  What I use is this approach with net-misc/netifrc banned from my system.

 

I mean - what is basic decision for using two interfaces for one eth0? Imaging that I do not use wifi at all. In debian it is possible to configure eth0 and eth0:1 with static and dhcp. What is the basic decision for the same thing in gentoo. I feel that it is rather simple but I can't find it.

----------

## comcon1

May be I misunderstand you. Do netifrc allow everythin that I need? If yes - I will study its manual.

----------

## charles17

 *comcon1 wrote:*   

> Do netifrc allow everythin that I need?

 I have no idea what you need or want.

 *comcon1 wrote:*   

> ... for using two interfaces for one eth0? 

 Network interfaces are what you get listed using either of tree /sys/class/net or ifconfig -a and there should be only one network interface called eth0.

----------

## UberLord

 *comcon1 wrote:*   

> I mean - what is basic decision for using two interfaces for one eth0? Imaging that I do not use wifi at all. In debian it is possible to configure eth0 and eth0:1 with static and dhcp. What is the basic decision for the same thing in gentoo. I feel that it is rather simple but I can't find it.

 

eth0:0 and eth0:1 are interface aliases.

Their sole purpose in life is to allow the ifconfig(8) tool to assign more than one address to eth0.

Luckily, Linux has moved on from this and now follows the BSD families where you just assign many addresses to eth0 and don't have to use aliases anymore.

To see your addresses, use iproute2(8) like so

```
ip a
```

While dhcpcd does not support a static AND dynamic configuration at the same time, it is possible to achieve this a custom hook like so

(untested, typed straight in here, may have errors, but you get the idea)

```
# /etc/dhcpcd.exit-hook

# Assign a static IP on start

if [ "$interface" = eth0 -a "$reason" = PREINIT ]; then

    ip a a 10.1.2.3/24 dev "$interface"

fi

```

----------

