# How do I prevent any networking from starting?

## curmudgeon

Thought I understood this (apparently not). :(

/etc/rc.conf contains:

```

rc_depend_strict='NO'

rc_hotplug='!net.net0 !net.net1'

```

And nothing in the runlevels should be starting it:

```

# rc-status -a

Runlevel: sysinit

 devfs                                  [  started  ]

 dmesg                                  [  started  ]

 kmod-static-nodes                      [  started  ]

 sysfs                                  [  started  ]

 tmpfiles.dev                           [  started  ]

 udev                                   [  started  ]

 udev-mount                             [  started  ]

Runlevel: boot

 alsasound                              [  started  ]

 bootmisc                               [  started  ]

 consolefont                            [  started  ]

 fsck                                   [  started  ]

 hibernate-cleanup                      [  started  ]

 hostname                               [  started  ]

 hwclock                                [  started  ]

 keymaps                                [  started  ]

 localmount                             [  started  ]

 loopback                               [  started  ]

 modules                                [  started  ]

 mtab                                   [  started  ]

 net.lo                                 [  started  ]

 procfs                                 [  started  ]

 root                                   [  started  ]

 swap                                   [  started  ]

 swapfiles                              [  started  ]

 sysctl                                 [  started  ]

 termencoding                           [  started  ]

 tmpfiles.setup                         [  started  ]

 urandom                                [  started  ]

Runlevel: default

 cupsd                                  [  started  ]

 dbus                                   [  started  ]

 hdparm                                 [  started  ]

 local                                  [  started  ]

 netmount                               [  stopped  ]

 smartd                                 [  started  ]

 syslog-ng                              [  started  ]

 vixie-cron                             [  started  ]

 xdm                                    [  started  ]

 xdm-setup                              [  started  ]

Runlevel: shutdown

 killprocs                              [  stopped  ]

 mount-ro                               [  stopped  ]

 savecache                              [  stopped  ]

Dynamic Runlevel: hotplugged

Dynamic Runlevel: needed

Dynamic Runlevel: manual

```

But in the startup log, I see:

```

dhcpcd[1108]: version 6.4.7 starting

dhcpcd[1108]: dev: loaded udev

dhcpcd[1108]: net0: adding address fe80::1443:409f:422f:52dd

dhcpcd[1108]: net1: adding address fe80::8100:f4af:f2a7:bf52

dhcpcd[1138]: net1: starting wpa_supplicant

dhcpcd[1108]: no interfaces have a carrier

dhcpcd[1108]: forked to background, child pid 1161

dhcpcd[1161]: net0: waiting for carrier

dhcpcd[1161]: net1: waiting for carrier

dhcpcd[1161]: net1: carrier acquired

dhcpcd[1161]: DUID 00:00:00:00:00:00:00:00:00:00:00:00:00:00

dhcpcd[1161]: net1: IAID 77:37:03:fe

dhcpcd[1161]: net1: carrier lost

dhcpcd[1161]: net1: soliciting a DHCP lease

```

I would like to prevent any networking from starting, unless I specifically start it manually.

----------

## charles17

 *curmudgeon wrote:*   

> Thought I understood this (apparently not). 
> 
> /etc/rc.conf contains:
> 
> ```
> ...

 Maybe it's triggered by starting net.lo?

----------

## WWWW

I would remove these two from runlevels:

netmount

dbus

And see what happens.

One more thing you could try is to unlink net.ethX or net.enpXXX to net.lo in /etc/init.d/.

Lastly set your interface to null in /etc/conf.d/net

config_eth0="null"

I don't know if this would be an overkill but adding !dhcpcd !ifconfig !iwconfig etc in /etc/init.d/net could help from accidental triggering.

A word on dbus. Isn't dbus linked to a myriad of services and programs? Either taking removing dbus USE flag from packages or disabling network capabilities on dbus could also help.

openrc, as odd as it seems, DEFAULTS to dhcpd, even with a BLANK /etc/conf.d/net. Quite odd given the nature of configurability of gentoo. And even if dhcpcd isn't installed it uses udhcp from BUSYBOX <--- WTF???

----------

## charles17

 *WWWW wrote:*   

> I would remove these two from runlevels:
> 
> netmount
> 
> dbus
> ...

 Why not just remove all Gentoo net.* scripts stuff as from https://wiki.gentoo.org/wiki/Dhcpcd and not add dhcpcd to a runlevel?

----------

## WWWW

 *charles17 wrote:*   

>  *WWWW wrote:*   I would remove these two from runlevels:
> 
> netmount
> 
> dbus
> ...

 

If you notice op has no dhcpcd service in any runlevel. Secondly he is not first being hit with openrc hidden default net option.

----------

## UberLord

net.lo no longer provides net.

You would need to ask a Gentoo netifrc dev why they made this change, I don't know for sure.

As such, the only thing you have installed that provides net is dhcpcd as you have no other net.* scripts.

This is why dhcpcd is started, and by default it will work on what it can.

So to stop dhcpcd from starting, you need to remove the need provision from the service that needs it, or provide it again in net.lo

You can do this in /etc/rc.conf

```
# net.lo provides net

rc_net_lo_provide="net"

# dhcpcd does not provide net

rc_dhcpcd_provide="!net"
```

You maybe able to find the service that needs net as well

```
/etc/init.d/dhcpcd needsme

/etc/init.d/dhcpcd usesme
```

----------

