# Q: How to avoid starting network interfaces on boot?

## Silmano

I'm reinstalling Gentoo on my laptop and I'm finding a weird behaviour when configuring my network. The laptop has both wired and wireless networking configured in /etc/conf.d/net like the following:

```
# Ethernet

config_enp5s0="192.168.1.120 netmask 255.255.255.0"

routes_enp5s0="default via 192.168.1.1"

# WiFi

modules_wlp3s0="wpa_supplicant"

config_wlp3s0="dhcp"
```

I don't have net.enp5s0 nor net.wlp3s0 included in any runlevel (I have the links from net.lo created), since I usually move the laptop around and I'll like to start the interface myself. The problem I'm finding is that both enp5s0 and wlp3s0 are getting dhcp addresses at boot (and since I don't have the wpa_supplicant fully configured yet, the wifi is getting an invalid IP)

```
-> % ifconfig

enp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.208  netmask 255.255.255.0  broadcast 192.168.1.255

        ether e8:11:32:17:81:30  txqueuelen 1000  (Ethernet)

        RX packets 1761  bytes 157798 (154.0 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 1340  bytes 265914 (259.6 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        loop  txqueuelen 0  (Local Loopback)

        RX packets 154  bytes 12196 (11.9 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 154  bytes 12196 (11.9 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        inet 169.254.208.124  netmask 255.255.0.0  broadcast 169.254.255.255

        ether 00:1b:b1:f0:9c:bf  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

And the different run level list:

```
-> % rc-update

                acpid |      default

             bootmisc | boot

                devfs |                       sysinit

                dmesg |                       sysinit

                 fsck | boot

             hostname | boot

              hwclock | boot

              keymaps | boot

            killprocs |              shutdown

    kmod-static-nodes |                       sysinit

                local |      default

           localmount | boot

             loopback | boot

              metalog |      default

              modules | boot

             mount-ro |              shutdown

                 mtab | boot

             netmount |      default

                 ntpd |      default

               procfs | boot

                 root | boot

            savecache |              shutdown

                 sshd |      default

                 swap | boot

            swapfiles | boot

               sysctl | boot

                sysfs |                       sysinit

         termencoding | boot

         tmpfiles.dev |                       sysinit

       tmpfiles.setup | boot

                 udev |                       sysinit

           udev-mount |                       sysinit

              urandom | boot

                  xdm |      default
```

Since I installed yesterday almost half of the installed packages, I don't really know if its because I modified any configuration file or because there's a package that is making the networks start without knowing it.

Is there any way to keep the IP configuration for both interfaces but tell Gentoo not to start them at boot (just start net.lo if needed)?

----------

## charles17

Would the solution of https://forums.gentoo.org/viewtopic-t-1002390-highlight-.html help?

For the services started please check  *Quote:*   

> $ rc-config show all

 

----------

## Silmano

I think the problem is net-misc/dhcpcd. I've deleted net.wlp3s0 link and deleted its configuration from /etc/conf.d/net, but its still being started:

```
Oct 30 11:14:41 [dhcpcd] version 6.4.7 starting

Oct 30 11:14:41 [dhcpcd] dev: loaded udev

Oct 30 11:14:41 [dhcpcd] wlp3s0: starting wpa_supplicant

Oct 30 11:14:42 [dhcpcd] no interfaces have a carrier

Oct 30 11:14:42 [dhcpcd] forked to background, child pid 1697

Oct 30 11:14:42 [dhcpcd] wlp3s0: waiting for carrier

Oct 30 11:14:42 [dhcpcd] enp5s0: waiting for carrier

Oct 30 11:14:42 [dhcpcd] wlp3s0: carrier acquired

Oct 30 11:14:42 [dhcpcd] DUID 00:01:00:01:1b:e3:be:00:00:1b:b1:f0:9c:bf

Oct 30 11:14:42 [dhcpcd] wlp3s0: IAID b1:f0:9c:bf

Oct 30 11:14:42 [dhcpcd] wlp3s0: carrier lost

Oct 30 11:14:47 [dhcpcd] enp5s0: carrier acquired

Oct 30 11:14:47 [dhcpcd] enp5s0: IAID 32:17:81:30

Oct 30 11:14:47 [dhcpcd] enp5s0: rebinding lease of 192.168.1.208

Oct 30 11:14:48 [dhcpcd] wlp3s0: using IPv4LL address 169.254.208.124

Oct 30 11:14:48 [dhcpcd] wlp3s0: adding route to 169.254.0.0/16

Oct 30 11:14:52 [dhcpcd] wlp3s0: soliciting a DHCP lease

Oct 30 11:14:53 [dhcpcd] enp5s0: leased 192.168.1.208 for 86400 seconds

Oct 30 11:14:53 [dhcpcd] enp5s0: adding route to 192.168.1.0/24

Oct 30 11:14:53 [dhcpcd] enp5s0: adding default route via 192.168.1.10
```

How do I tell net-misc/dhcpcd to avoid overwritting net.enp5s0 IP configuration?

EDIT: Why does net-misc/dhcpcd by-pass init.d scripts now? I've been reading the wiki (http://wiki.gentoo.org/wiki/Network_management_using_DHCPCD) and it now seems net-misc/dhcpcd is the boss of the networks right now and will start them despite your init.d scripts. I've edited my /etc/dhcpcd.conf adding enp5s0 configuration and now it gets the static address.

Its been a while since I last configured this laptop, but any idea why net-misc/dhcpcd bypasses all configuration files and just reads its own? Any suitable alternative to just regain control of the interfaces via /etc/conf.d/net and init.d scripts?

----------

## charles17

Settings in /etc/conf.d/net are only relevant for Gentoo net.* scripts, regardless if started manually or from the runlevel. 

Once you start /etc/init.d/dhcpcd then only /etc/dhcpcd.conf is relevant. https://wiki.gentoo.org/wiki/Network_management_using_DHCPCD#Migration_from_Gentoo_net..2A_scripts

You'd better decide for only one network manager.  Either dhcpcd or netifrc (Gentoo net.* scripts).

----------

