# Stopping gentoo from starting network interfaces at boot

## stan999

Hi all,

In using Debian Wheezy, I am used to starting network interfaces manually and would like to do the same for Gentoo.

In Debian, I configure the network interfaces in /etc/network/interfaces. And I'll start or stop them using ifup or ifdown.

For example, I could have various configurations for eth0

iface ethofficestatic

iface ethhomestatic

iface ethhomedhcp

iface wlancafedhcp

iface wlanofficedhcp

I would like to do the same in Gentoo except there is no /etc/network/interfaces to be found.

I have one wired port, one wireless, and from time to time I'll plug in an usb-ethernet adapter.

Any ideas / tips?

Thanks in advance!

----------

## charles17

Why not leave it all to DHCPCD?

----------

## stan999

Hey charles17

I just found out that dhcpcd will start all network interfaces. https://wiki.archlinux.org/index.php/Dhcpcd This is for archlinux but it appears to apply to my case.

I removed dhcpcd and brought in dhclient. Currently I'm able to start eth0 manually and bring in dhcp via dhclient.

To get to static IP address, the usual ifconfig applies. (I'll look into iproute2) 

I've looked into your URL. I think it means dhcpcd will be applied to all interfaces - which is not what i want.

 *charles17 wrote:*   

> Why not leave it all to DHCPCD?

 

----------

## UberLord

 *stan999 wrote:*   

> I just found out that dhcpcd will start all network interfaces.

 

You trust a wiki over my fine man pages? dhcpcd(8 ) dhcpcd.conf(5)  :Smile: 

It will by default, but this can be restricted by the command line or dhcpcd.conf(5).

When triggered via net.* it is restricted.

 *Quote:*   

> 
> 
> I removed dhcpcd and brought in dhclient. Currently I'm able to start eth0 manually and bring in dhcp via dhclient.

 

Ewww. dhcpcd is so much better than dhclient. I could bore you with the technical details of why if you wanted.

When running via net.eth0, dhcpcd will behave like dhclient.

Just remember to remove dhcpcd from any default runlevels.

So in summary:

/etc/init.d/net.eth0 will start dhcpcd only for eth0

/etc/init.d/dhcpcd will start dhcpcd for all interfaces unless restricted by dhcpcd.conf(5)

Still, I'd like to know why you feel the urge to manually handle your interfaces. What are your use cases for doing this and why don't you feel they can be automated?

----------

## stan999

O forgive me UberLord. I am not worthy!

I agree using dhcpcd is much easier than dhclient. I'll find sometime to revert back. I had been spending more than intended on this issue alone (oh the joys of learning!)

The premise for me to manually manage interfaces basically stems from my previous experience using Debian.

I like to start up a machine that does not try to probe or connect to the network when booted up. I'd like the machine to call dhcpcd only (or to a static ip)  when i startup the interface.

In my previous debian instance, I had setup two scenarios for eth0. First scenario for it to connect via static ip and the other for it to connect via dhcp. Reason for this, I had port forwarding to the static ip (dmz). Whereas for the dhcp scenario, I didn't want to be in the dmz for normal web surfing.

Does this make sense? There is probably a better way of managing my use cases. I'll be interested to hear from you if there is a better way of doing things.

 *UberLord wrote:*   

>  *stan999 wrote:*   I just found out that dhcpcd will start all network interfaces. 
> 
> You trust a wiki over my fine man pages? dhcpcd(8 ) dhcpcd.conf(5) 
> 
> It will by default, but this can be restricted by the command line or dhcpcd.conf(5).
> ...

 

----------

## UberLord

 *stan999 wrote:*   

> O forgive me UberLord. I am not worthy!

 

https://www.youtube.com/watch?v=-FucbvoFFy0

 :Very Happy: 

 *Quote:*   

> I agree using dhcpcd is much easier than dhclient. I'll find sometime to revert back. I had been spending more than intended on this issue alone (oh the joys of learning!)
> 
> The premise for me to manually manage interfaces basically stems from my previous experience using Debian.
> 
> I like to start up a machine that does not try to probe or connect to the network when booted up. I'd like the machine to call dhcpcd only (or to a static ip)  when i startup the interface.
> ...

 

Scenario 1) eth0 is on the same network. Why not assign a static IP and let dhcpcd get a dynnamic IP? This works fine  :Smile:  although you'll have to use the ip address command to see it as ifconfig won't show it.

Scenario 2) two different networks. Why not setup dhcpcd to arping your fixed router to setup a static ip and fall back to dhcp if not found?

Both of these are very easily automated  :Smile: 

----------

