# How to make eth0 always on.

## ayvango

The current behaviour is that gentoo assigns no ip address to an interface that has cable unplugged. But I need to run dnsmasq on it and it requires ip address set. Could I convince conf.d/net to made eht0 always up regardless of cable state?

----------

## bunder

i'm not sure if this will work, but...

/etc/conf.d/net

```
fallback_eth0="192.168.1.16 netmask 255.255.255.0"

fallback_route_eth0="default via 192.168.1.1"

```

----------

## krinn

dhcpcd could assign a 169. kind of address

or you could also set rc_dnsmasq_need="net" in rc.conf so that dnsmasq is start if net.eth0 is start.

i'm unsure what will do the right job out of "need" "after" or "use" keyword.

----------

## UberLord

Make a bridge and add a tap device you assign your static IP to along with eth0

----------

## ayvango

 *Quote:*   

> 
> 
> Make a bridge and add a tap device you assign your static IP to along with eth0
> 
> 

 

I just checked: ip adr add $addr dev eth0 works fine. So there is no really need in any tap device to use gentoo in home router. I need only to force /etc/init.d/net.eth0 script to do that command

----------

## khayyam

 *ayvango wrote:*   

> The current behaviour is that gentoo assigns no ip address to an interface that has cable unplugged. But I need to run dnsmasq on it and it requires ip address set. Could I convince conf.d/net to made eht0 always up regardless of cable state?

 

ayvango ... I think you are wrong in that assumption, and/or something else is going on here:

```
# cat /sys/class/net/eth0/carrier

0

# egrep -v '(^#|^$)' /etc/conf.d/net.eth0

modules_eth0="!plug iproute2"

config_eth0="192.168.0.2/24"

# /etc/init.d/net.eth0 start

 * Bringing up interface eth0

 *   192.168.0.2/24 ...          [ ok ]

# ip -4 addr show dev eth0

2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000

    inet 192.168.0.2/24 brd 192.168.0.255 scope global eth0

       valid_lft forever preferred_lft forever
```

There is no carrier but the address is still asigned, and the operation, as far as openrc is concerned, is successful.

Perhaps if you provide your conf.d/net and other relevant info we can get a better idea of what's going on.

best ... khay

----------

## ayvango

 *khayyam wrote:*   

> 
> 
> modules_eth0="!plug iproute2"
> 
> 

 

That was the essential part, many thanks to you.

----------

