View previous topic :: View next topic |
Author |
Message |
ayvango Tux's lil' helper
Joined: 08 Feb 2012 Posts: 118
|
Posted: Mon Dec 25, 2017 7:24 am Post subject: How to make eth0 always on. |
|
|
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? |
|
Back to top |
|
|
bunder Bodhisattva
Joined: 10 Apr 2004 Posts: 5934
|
Posted: Mon Dec 25, 2017 9:17 am Post subject: |
|
|
i'm not sure if this will work, but...
/etc/conf.d/net
Code: | fallback_eth0="192.168.1.16 netmask 255.255.255.0"
fallback_route_eth0="default via 192.168.1.1"
|
|
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Mon Dec 25, 2017 9:25 am Post subject: |
|
|
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. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
ayvango Tux's lil' helper
Joined: 08 Feb 2012 Posts: 118
|
Posted: Mon Dec 25, 2017 12:12 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Mon Dec 25, 2017 6:16 pm Post subject: Re: How to make eth0 always on. |
|
|
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:
Code: | # 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 |
|
Back to top |
|
|
ayvango Tux's lil' helper
Joined: 08 Feb 2012 Posts: 118
|
Posted: Thu Dec 28, 2017 2:55 pm Post subject: Re: How to make eth0 always on. |
|
|
khayyam wrote: |
modules_eth0="!plug iproute2"
|
That was the essential part, many thanks to you. |
|
Back to top |
|
|
|