# [solved]How do I make it so that eth0 does not default start

## athena810

I'm running gentoo on my laptop, the annoying thing is that everytime it boots, it defaults try to start eth0. It says

```
*bringing up interface eth0

*no configuration specified, 

*defualt to dhcp"
```

I don't use wlan0 since I'm on a laptop so it trying to bring up eth0 everytime is annoying because I always have to wait for  it to time out. Any solutions?Last edited by athena810 on Mon Sep 03, 2012 4:55 pm; edited 1 time in total

----------

## The Doctor

make sure its not the default run level

next modify this file: /etc/rc.conf

look for this line:

RC_PLUG_SERVICES=""

and change it so it includes this:

RC_PLUG_SERVICES="!net.*"

You might need to uncomment the line, I don't remember. It should exist.

----------

## Odward

If you don't need eth0 to start, I think the most likely solution would be

```
rc-update del net.eth0 default
```

----------

## The Doctor

 *Odward wrote:*   

> If you don't need eth0 to start, I think the most likely solution would be
> 
> ```
> rc-update del net.eth0 default
> ```
> ...

 

Unfortunately, this will not solve the problem completely. The init system is smart  enough to autostart the net.eth0 for scrips that need="net". You also need to edit the file I specified to tell the init system not to start the net. But you are quite right, it is the first step to solving the problem.

----------

## Odward

 *The Doctor wrote:*   

> The init system is smart enough to autostart the net.eth0 for scrips that need="net".

 

Hopefully I'm not sidetracking the thread, but for the sake of learning -if it's a reasonably easy answer- why wouldn't net.lo provide 'net'?

Also I assumed, I know that's dangerous, athena810 meant to say s/he uses wireless on the laptop so would still need networking.

If I understand your instructions it will not load any network at all by default.  I know the post said "I don't use wlan0" but then mentions

being a laptop, so it just seemed more likely that was a typo.  If that wasn't a typo, sorry for assuming  :P

----------

## The Doctor

 *Odward wrote:*   

>  *The Doctor wrote:*   The init system is smart enough to autostart the net.eth0 for scrips that need="net". 
> 
> Hopefully I'm not sidetracking the thread, but for the sake of learning -if it's a reasonably easy answer- why wouldn't net.lo provide 'net'?

 

Oh don't worry. Its right on topic and a very good question. net.lo is a local loopback device and yes I think it does something about providing net. But there we go with clever programmers who know that and also know that the external network is not provided. The innit scripts know what they need so they do not need to be explicitly enabled in the right order by user, unlike some other systems. so when the innit scripts say "I need this" the innit system looks for "this". In this case "this" is the network and the Gentoo innit system knows that "net.lo" is not the net it needs so it looks for the other nets.* scripts. In this case, the innit scrips think they need to start the scrips but that is not what you want so you need to tell the innit program that the net scripts are off the menu. Of course, it might not. It depends on what other scrips are started during the boot process.

The reason one would do this is to run something like wicd or other GUI which handles the network but doesn't quite do it in the same way.

Of course, blacklisting the net.wlan0 script only is possible by specifying RC_PLUG_SERVICES="!net.wlan0"

----------

## khayyam

 *Odward wrote:*   

>  *The Doctor wrote:*   The init system is smart enough to autostart the net.eth0 for scrips that need="net". 
> 
> Hopefully I'm not sidetracking the thread, but for the sake of learning -if it's a reasonably easy answer- why wouldn't net.lo provide 'net'?

 

Odward ... you might be interested in this thread from the gentoo-dev mailing list.

athena810 ... if you don't want 'net.eth0' to provide net (and I mean 'provide' in the openrc sense) then you would add the following to /etc/conf.d/net or /etc/rc.conf 

```
rc_net_eth0_provide="!net"
```

As The Doctor pointed out, an interface can be started for two reasons 1. you added it to a runlevel (in which case remove it) or 2. it is started by some service which 'need net'. The init system scripts have a syntax like the following (from /etc/init.d/pdnsd which is a DNS daemon and so obviously needs access to the network to function correctly).

```
depend() {

   need net

   provide dns

}
```

So, pdnsd needs 'net' and provides 'dns', and the same is true of other services. This can make things complicated for systems that have intermitant network connectivity, or who's network is not guarenteed to be available on boot. In this case it is advisable not to add these services to the 'default' run level but have them start when network is available. There are a number of ways this could be approached, but probably the simplist [EDIT: a better method using 'run-levels'] is to create an 'online' run-level.

```
# cd /etc/runlevels

# mkdir online

# rc-update -s add default online # the '-s' is for 'stacked' 

# rc-update add net.wlan0 online # where wlan0 would be providing 'net'

# rc-update add <service> online # add all service you want started when wlan0 is started
```

Then, when you want to go online issue 'rc online' and all the additional services for this run-level will be started.

best ... khay

EDIT: changed to using a 'stacked' run-levelLast edited by khayyam on Tue Sep 04, 2012 7:27 pm; edited 1 time in total

----------

## krinn

 *khayyam wrote:*   

> 
> 
> As The Doctor pointed out, an interface can be started for two reasons 1. you added it to a runlevel (in which case remove it) or 2. it is started by some service which 'need net'. The init system scripts have a syntax like the following (from /etc/init.d/pdnsd which is a DNS daemon and so obviously needs access to the network to function correctly).
> 
> 

 

3  :Smile: 

devices can initiate service, per example udev discovering an ethernet card might load its driver and initiate the start of net.eth0

As a "it's there, it provide something, but even none ask it yet, it's there so run it".

On subject, you can just blacklist the module loading for your network card, removing the hardware function until you load the module by hand (if need at all)

----------

## khayyam

 *krinn wrote:*   

>  *khayyam wrote:*   [...] an interface can be started for two reasons 1. you added it to a runlevel (in which case remove it) or 2. it is started by some service which 'need net'. 
> 
> 3. devices can initiate service, per example udev discovering an ethernet card might load its driver and initiate the start of net.eth0.

 

krinn ... I've never seen this happen, and I load and unload the ath5k driver on occasion, perhaps this is the case if dbus is running, or rc_hotplug="*" is set in rc.conf (which it isn't by default).

best ... khay

----------

## athena810

 *Odward wrote:*   

>  *The Doctor wrote:*   The init system is smart enough to autostart the net.eth0 for scrips that need="net". 
> 
> Hopefully I'm not sidetracking the thread, but for the sake of learning -if it's a reasonably easy answer- why wouldn't net.lo provide 'net'?
> 
> Also I assumed, I know that's dangerous, athena810 meant to say s/he uses wireless on the laptop so would still need networking.
> ...

 

yeah, that was a typo, I'll try some things and get back to you guys on what worked. Thanks for your replies.

'rc-update del net.eth0 defaul't worked perfectly flawless. Thanks everyone.

----------

