Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
net.eth0 does not exist but dhcpcd works
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
saito
Apprentice
Apprentice


Joined: 12 Jun 2021
Posts: 187

PostPosted: Thu Dec 21, 2023 2:25 pm    Post subject: net.eth0 does not exist but dhcpcd works Reply with quote

Hi,
I have built a Gentoo system on a new N100(intel) device, the only issue is net.eth0 does not exist with report:
Code:
rc-service net.eth0 start
 * Bringing up interface eth0
 *   ERROR: interface eth0 does not exist
 *   Ensure that you have loaded the correct kernel module for your hardware
 * ERROR: net.eth0 failed to start

while the the `dhcpcd` works well and it's accessible remotely with ssh already. I have already
Code:
touch /etc/udev/rules.d/80-net-name-slot.rules

but it does not work in my situation.

Please provide your advice and experience, I will keep looking for the answer myself

Thanks, saito
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54342
Location: 56N 3W

PostPosted: Thu Dec 21, 2023 2:31 pm    Post subject: Reply with quote

saito,

udev will have renamed eth0.

Code:
dmesg | grep eth0

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 933
Location: Richmond Hill, Canada

PostPosted: Thu Dec 21, 2023 2:50 pm    Post subject: Reply with quote

saito,

Network is working is mostly due to you have service(s) need network to function.

try run
Code:
rc-status
You will likely see that dhcpcd is under Dynamic Runlevel: needed/wanted
example:
 sshd                                                              [  started  ]
 xdm                                                               [  started  ]
 rsyncd                                                            [  started  ]
 local                                                             [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
 dhcpcd                                                            [  started  ]
 display-manager-setup                                             [  started  ]
 rpcbind                                                           [  started  ]
 rpc.statd                                                         [  started  ]
 rpc.pipefs                                                        [  started  ]
 rpc.idmapd                                                        [  started  ]
 nfsclient                                                         [  started  ]
 atd                                                               [  started  ]


dhcpcd by default run in master mode and listen for all interfaces. so that is why your network is functional.
Back to top
View user's profile Send private message
saito
Apprentice
Apprentice


Joined: 12 Jun 2021
Posts: 187

PostPosted: Thu Dec 21, 2023 2:50 pm    Post subject: Reply with quote

Neddy,

Hi, you are completely right, here
Code:
dmesg | grep eth0
[    1.159296] igc 0000:02:00.0 eth0: MAC: a8:b8:e0:02:8c:02
[    3.888727] igc 0000:02:00.0 enp2s0: renamed from eth0

The current interface is renamed from eth0. The issue is the service net.eth0 can not start on default Runlevel, therefore I have to start the `dhcpcd` service to enable the internet access on my new N100 device, While On my old Gentoo workstation the `net.eth0` works well and `dhcpcd` is disabled normally.

Thanks
Back to top
View user's profile Send private message
saito
Apprentice
Apprentice


Joined: 12 Jun 2021
Posts: 187

PostPosted: Thu Dec 21, 2023 3:13 pm    Post subject: Reply with quote

pingtoo wrote:
saito,

Network is working is mostly due to you have service(s) need network to function.

try run
Code:
rc-status
You will likely see that dhcpcd is under Dynamic Runlevel: needed/wanted
example:
 sshd                                                              [  started  ]
 xdm                                                               [  started  ]
 rsyncd                                                            [  started  ]
 local                                                             [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
 dhcpcd                                                            [  started  ]
 display-manager-setup                                             [  started  ]
 rpcbind                                                           [  started  ]
 rpc.statd                                                         [  started  ]
 rpc.pipefs                                                        [  started  ]
 rpc.idmapd                                                        [  started  ]
 nfsclient                                                         [  started  ]
 atd                                                               [  started  ]


dhcpcd by default run in master mode and listen for all interfaces. so that is why your network is functional.


pingtoo:

Thanks. I know the Runlevel of `dhcpcd` since I run "rc-service dhcpcd start" and "rc-update add dhcpcd default", then of course, `dhcpcd` provides the internet access.
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 933
Location: Richmond Hill, Canada

PostPosted: Thu Dec 21, 2023 3:20 pm    Post subject: Reply with quote

saito,

You are welcome.

My interpretation of your original post was 'no net.eth0' yet dhcpcd started, without manual intervention' That is why I think it is because service dependency.

You can give it a try to see if you remove dhdpcd from default level and reboot to see if it also started by fall under 'Dynamic Runlevel'. This is how it work for my current configuration.
Back to top
View user's profile Send private message
saito
Apprentice
Apprentice


Joined: 12 Jun 2021
Posts: 187

PostPosted: Thu Dec 21, 2023 3:27 pm    Post subject: Reply with quote

pingtoo,

Nice to communicate with you.

Usually, I disable the `dhcpcd` on my Gentoo system, here is the rc-status
Code:
c-status
Runlevel: default
 sshd                                                                                                [  started  ]
 dhcpcd                                                                                              [  started  ]
 netmount                                                                                            [  stopped  ]
 local                                                                                               [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
Dynamic Runlevel: manual


I will enhance the networking function of this N100 device, this topic would be dig deeply.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54342
Location: 56N 3W

PostPosted: Thu Dec 21, 2023 4:06 pm    Post subject: Reply with quote

saito,

Either use the new interface name everywhere or tell udev not to do the rename.
There is a kernel command line parameter for that.

As long as everything is self consistent, it will work as expected.

Your net.eth0 cannot start as it does not exist.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
saito
Apprentice
Apprentice


Joined: 12 Jun 2021
Posts: 187

PostPosted: Thu Dec 21, 2023 4:27 pm    Post subject: Reply with quote

Neddy,

Happy to heard from you. My target is to specialize this N100 Gentoo System as a Gentoo Router like openwrt or better than openwrt. Therefore it's necessary to specify each interface with correct name for a router. While I am reading https://wiki.gentoo.org/wiki/Home_router.

Thanks for your nice attention,
saito
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54342
Location: 56N 3W

PostPosted: Thu Dec 21, 2023 5:03 pm    Post subject: Reply with quote

saito,

My router uses MAC Addresses to name the interfaces.

/etc/udev/rules.d/70-persistent-net.rules ...

Code:
# Fix our names as we have USB Network ports.
# ether dc:a6:32:03:87:77 The real Ethernet - green after Smoothwall.
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="dc:a6:32:03:87:77", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="green"

# ether a0:ce:c8:72:ee:ef A USB dongle - Red, the big bad Internet
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="a0:ce:c8:72:ee:ef", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="red"

# ether a0:ce:c8:76:b0:a5 Another USB dongle - Blue, the untrusted network.
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="a0:ce:c8:76:b0:a5", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="blue"

# ether a0:ce:c8:5d:ce:4b Another USB dongle - The DMZ
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="a0:ce:c8:5d:ce:4b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="dmz"

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
saito
Apprentice
Apprentice


Joined: 12 Jun 2021
Posts: 187

PostPosted: Thu Dec 21, 2023 5:12 pm    Post subject: Reply with quote

Neddy,

Thanks for your share. I would learn something from Openwrt as well as following your advice. If I have new issue or progress in building this functional gentoo router, I wish to come back you in proper time.

saito
Back to top
View user's profile Send private message
mortonP
Tux's lil' helper
Tux's lil' helper


Joined: 22 Dec 2015
Posts: 84

PostPosted: Sun Dec 24, 2023 7:46 pm    Post subject: Reply with quote

I attach myself to this thread, since I'm seeing a... similar situation?

OpenRC+dhcpcd

Until now:
net.ifnames=1
/etc/udev/rules.d/70-persistent-net.rules
Kernel gives a persistent eth interface name
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="........", ATTR{type}=="1", NAME="eth0"
so Udev rules rename to eth0 or eth1 etc.


Today update from kernel 6.1.x to 6.6.x. Now:
[ 1.098722] e1000e 0000:00:1f.6 eth0: (PCI Express:2.5GT/s:Width x1)
[ 4.087910] e1000e 0000:00:1f.6 eth0: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
[ 7.738130] e1000e 0000:00:1f.6 eno1: renamed from eth0 (while UP)

The last "renamed" line is new with 6.6.x!
...and udev rule(s) do not seem to work anymore
-> I have now the eno1 name, no eth0, and scripts fail :-(

What changed within the last year?


I want an image that works on different machines:
If only one Ethernet interface -> make it eth0
When more then one Ethernet interface, make it a specific order eth0, eth1, ... as specified in udev rules.

net.ifnames=0 works for machines with only one eth interface just fine.
...but does not work with more than one ethernet, if e.g. eth0/eth1 are swapped randomly by the kernel,
as udev rules are applied piece by piece, there is no way to make a swap eth0<->eth1 in one operation?

This is.... hm... I'm kinda stuck how to fix this :-/

...maybe more chocolate does help?
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1694

PostPosted: Sun Dec 24, 2023 7:58 pm    Post subject: Reply with quote

mortonP wrote:
Until now:
net.ifnames=1
/etc/udev/rules.d/70-persistent-net.rules
Kernel gives a persistent eth interface name
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="........", ATTR{type}=="1", NAME="eth0"
so Udev rules rename to eth0 or eth1 etc.

Using udev rules to rename with eth prefix will no longer work. If it is renamed to something else, then it will (like "net0")
If you want the original eth* names assigned by the kernel, use net.ifnames=0.
Swapping interface names with one that exists has been removed from all udev code.
Back to top
View user's profile Send private message
Koyan
n00b
n00b


Joined: 07 Nov 2014
Posts: 22

PostPosted: Mon Dec 25, 2023 1:52 pm    Post subject: Reply with quote

grknight wrote:
Swapping interface names with one that exists has been removed from all udev code.


Is there any way to get this functionality back? I have a server with two interfaces, and as you'd expect after a reboot, sometimes their names get swapped around. It used to be perfectly possible to use udev to name one eth0 and the other eth1 consistently, but since systemd implemented their ironically named 'predictable' naming system they removed this working functionality.

Right now I rename them en0 and en1, but I just want a simple, standard eth0 and eth1, and they've actually gone out of their way to prevent you from doing that. And I'm certainly not going to be forced to use ridiculous names like en4ps12wtf5.

It's very disappointing to see that even eudev didn't retain the original functionality.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54342
Location: 56N 3W

PostPosted: Mon Dec 25, 2023 2:18 pm    Post subject: Reply with quote

Koyan,

No. You must not use the kernel names yourself.
Horrible things happen when two different devices get the same name.

If your NICs use different drivers, build the driver for the card you want to be eth0 into the kernel.
Build the other as a module. As modules are iniitalised after built in, the names won't change.

As networks have become more complex, so the choices that users with only ore or two interfaces have had to be reduced to make the complexity deterministic.

Rename your interfaces based on MAC addresses. That's what old udev used to to anyway.
Name swapping is not possible and was always a bit of a hack.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mortonP
Tux's lil' helper
Tux's lil' helper


Joined: 22 Dec 2015
Posts: 84

PostPosted: Wed Dec 27, 2023 10:56 pm    Post subject: Reply with quote

grknight wrote:

Using udev rules to rename with eth prefix will no longer work. If it is renamed to something else, then it will (like "net0")
If you want the original eth* names assigned by the kernel, use net.ifnames=0.
Swapping interface names with one that exists has been removed from all udev code.


Thanks for confirming that things have changed.

But I think I found a solution:
Setting net.ifnames=0
Example: Gives two interfaces eth0/eth1 - but in unstable order.
Udev rules seem to be applied in order.
-> one rule renames "unimportant" eth to something higher that surely does not exist yet, for example eth2.
another rule renames "wanted" interface to eth0.

Seems to work so far - but I guess after 100 reboots I'm more sure....
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54342
Location: 56N 3W

PostPosted: Thu Dec 28, 2023 11:40 am    Post subject: Reply with quote

mortonP,

Quote:
Udev rules seem to be applied in order.
-> one rule renames "unimportant" eth to something higher that surely does not exist yet, for example eth2.
another rule renames "wanted" interface to eth0.


It will break when you connect another network interface. Either deliberately or accidentality. It's very fragile.
Use name that you are in control of. Consistently and everywhere, then let the kernel and udev do its thing.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
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