Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to make eth0 always on.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ayvango
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2012
Posts: 118

PostPosted: Mon Dec 25, 2017 7:24 am    Post subject: How to make eth0 always on. Reply with quote

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
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5934

PostPosted: Mon Dec 25, 2017 9:17 am    Post subject: Reply with quote

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
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Dec 25, 2017 9:25 am    Post subject: Reply with quote

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
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Mon Dec 25, 2017 10:36 am    Post subject: Reply with quote

Make a bridge and add a tap device you assign your static IP to along with eth0
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
ayvango
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2012
Posts: 118

PostPosted: Mon Dec 25, 2017 12:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Mon Dec 25, 2017 6:16 pm    Post subject: Re: How to make eth0 always on. Reply with quote

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
View user's profile Send private message
ayvango
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2012
Posts: 118

PostPosted: Thu Dec 28, 2017 2:55 pm    Post subject: Re: How to make eth0 always on. Reply with quote

khayyam wrote:

modules_eth0="!plug iproute2"

That was the essential part, many thanks to you.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum