Discussion:
Getting the IP address at startup
(too old to reply)
Aelius Gallus
2023-10-09 01:29:24 UTC
Permalink
My Dell laptop stopped working and I transferred its hard disk to another
one. Slackware-15.0 is working fine, except that it doesn't get its IP from
the router.

Every time I start Slackware, I have to get its IP address using the dhclient
or dhcpcd command with eth2 as a NIC number; it was eth0 before, but this is
not a problem. How can I correct this situation?

Any help will be appreciated.
Marco Moock
2023-10-09 07:32:07 UTC
Permalink
Post by Aelius Gallus
Every time I start Slackware, I have to get its IP address using the
dhclient or dhcpcd command with eth2 as a NIC number; it was eth0
before, but this is not a problem. How can I correct this situation?
Do you use the NetworkManager?
Aelius Gallus
2023-10-09 11:37:04 UTC
Permalink
Post by Marco Moock
Post by Aelius Gallus
Every time I start Slackware, I have to get its IP address using the
dhclient or dhcpcd command with eth2 as a NIC number; it was eth0
before, but this is not a problem. How can I correct this situation?
Do you use the NetworkManager?
Just transferred the hard disk from one laptop to the other.
Didn't use any command or Network Manager.
Petri Kaukasoina
2023-10-09 09:40:52 UTC
Permalink
Post by Aelius Gallus
Every time I start Slackware, I have to get its IP address using the dhclient
or dhcpcd command with eth2 as a NIC number; it was eth0 before, but this is
not a problem. How can I correct this situation?
rm /etc/udev/rules.d/70-persistent-net.rules
Aelius Gallus
2023-10-09 11:33:24 UTC
Permalink
Post by Petri Kaukasoina
Post by Aelius Gallus
Every time I start Slackware, I have to get its IP address using the
dhclient or dhcpcd command with eth2 as a NIC number; it was eth0 before,
but this is not a problem. How can I correct this situation?
rm /etc/udev/rules.d/70-persistent-net.rules
Removed the file, and after restart, eth2 became eth126. And had to use,
as before, the dhcpcd command to get an IP address.
Petri Kaukasoina
2023-10-09 14:18:07 UTC
Permalink
Post by Aelius Gallus
Post by Petri Kaukasoina
Post by Aelius Gallus
Every time I start Slackware, I have to get its IP address using the
dhclient or dhcpcd command with eth2 as a NIC number; it was eth0 before,
but this is not a problem. How can I correct this situation?
rm /etc/udev/rules.d/70-persistent-net.rules
Removed the file, and after restart, eth2 became eth126. And had to use,
as before, the dhcpcd command to get an IP address.
How many ethernet card do you have:

dmesg|grep eth

The idea of 70-persistent-net.rules is to keep the names of ethernet
interfaces constant even after adding extra cards. I have a machine which
has one built-in ethernet port (tigon3). udev has created a line in
70-persistent-net.rules for naming it eth0. I have later added another card
(intel e100). udev added a line naming it eth1. Because e100 is found first
after boot, it becomes eth0, and tg3 becomes eth1. With the help of
70-persistent-net.rules, udev then changes the names by renaming eth0 to
eth126, eth1 to eth125, eth126 to eth1, and finally eth125 to eth0. So tg3
is eth0 as originally!

If you removed 70-persistent-net.rules, you should only have eth0 in that
file after reboot. Or, if you have more than one ethernet chip, you could
see that shuffling take place in dmesg but eth126 should not be left there.
Aelius Gallus
2023-10-10 02:15:40 UTC
Permalink
Post by Petri Kaukasoina
Post by Aelius Gallus
Post by Petri Kaukasoina
Post by Aelius Gallus
Every time I start Slackware, I have to get its IP address using the
dhclient or dhcpcd command with eth2 as a NIC number; it was eth0 before,
but this is not a problem. How can I correct this situation?
rm /etc/udev/rules.d/70-persistent-net.rules
Removed the file, and after restart, eth2 became eth126. And had to use,
as before, the dhcpcd command to get an IP address.
dmesg|grep eth
The idea of 70-persistent-net.rules is to keep the names of ethernet
interfaces constant even after adding extra cards. I have a machine which
has one built-in ethernet port (tigon3). udev has created a line in
70-persistent-net.rules for naming it eth0. I have later added another card
(intel e100). udev added a line naming it eth1. Because e100 is found first
after boot, it becomes eth0, and tg3 becomes eth1. With the help of
70-persistent-net.rules, udev then changes the names by renaming eth0 to
eth126, eth1 to eth125, eth126 to eth1, and finally eth125 to eth0. So tg3
is eth0 as originally!
If you removed 70-persistent-net.rules, you should only have eth0 in that
file after reboot. Or, if you have more than one ethernet chip, you could
see that shuffling take place in dmesg but eth126 should not be left there.
-----
Thank you very much for your long explanation. The problem has been solved,
please read the following threads.
Chris Elvidge
2023-10-09 09:46:16 UTC
Permalink
Post by Aelius Gallus
My Dell laptop stopped working and I transferred its hard disk to another
one. Slackware-15.0 is working fine, except that it doesn't get its IP from
the router.
Every time I start Slackware, I have to get its IP address using the dhclient
or dhcpcd command with eth2 as a NIC number; it was eth0 before, but this is
not a problem. How can I correct this situation?
Any help will be appreciated.
Investigate /etc/rc.d/rc.inet1.conf
There are sections there for eth0, eth1, eth2 etc
USE_DHCP[X] should be 'yes' for any interface that needs dhcp

'ip a' (as root) will give you a list of interfaces on the machine.
--
Chris Elvidge, England
THE FIRST AMENDMENT DOES NOT COVER BURPING
Aelius Gallus
2023-10-09 11:25:45 UTC
Permalink
Post by Chris Elvidge
Investigate /etc/rc.d/rc.inet1.conf
There are sections there for eth0, eth1, eth2 etc
USE_DHCP[X] should be 'yes' for any interface that needs dhcp
'ip a' (as root) will give you a list of interfaces on the machine.
Added the following lines to /etc/rc.d/rc.inet1.conf:

# IPv4 config options for eth126:
IPADDRS[126]=""
USE_DHCP[126]="yes"
# IPv6 config options for eth126:
IP6ADDRS[126]=""
USE_SLAAC[126]=""
USE_DHCP6[126]=""
# Generic options for eth126:
DHCP_HOSTNAME[126]=""

(Please see above follow-ups for the value eth126, instead of former eth2)
After restart, had to use, as before, the dhcpcd command to get an
IP address.
RinaldiJ
2023-10-09 12:21:31 UTC
Permalink
Post by Aelius Gallus
Post by Chris Elvidge
Investigate /etc/rc.d/rc.inet1.conf
There are sections there for eth0, eth1, eth2 etc
USE_DHCP[X] should be 'yes' for any interface that needs dhcp
'ip a' (as root) will give you a list of interfaces on the machine.
IPADDRS[126]=""
USE_DHCP[126]="yes"
IP6ADDRS[126]=""
USE_SLAAC[126]=""
USE_DHCP6[126]=""
DHCP_HOSTNAME[126]=""
(Please see above follow-ups for the value eth126, instead of former eth2)
After restart, had to use, as before, the dhcpcd command to get an
IP address.
Curious. What does ifconfig tell you?

And cat /etc/rules.d/70-persistent-net.rules

Rinaldi
Aelius Gallus
2023-10-10 01:35:29 UTC
Permalink
Post by RinaldiJ
Curious. What does ifconfig tell you?
And cat /etc/rules.d/70-persistent-net.rules
Rinaldi
--------
bash-5.1$ ifconfig -a
eth126: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.11.2 netmask 255.255.255.0 broadcast 192.168.11.255
inet6 fe80::e967:c7e3:b350:3c21 prefixlen 64 scopeid 0x20<link>
ether 74:2b:62:87:73:61 txqueuelen 1000 (Ethernet)
RX packets 58 bytes 31116 (30.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 134 bytes 11638 (11.3 KiB)
TX errors 1 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
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
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
-------
bash-5.1$ cat /etc/rules.d/70-persistent-net.rules
cat: /etc/rules.d/70-persistent-net.rules: No such file or directory
bash-5.1$
RinaldiJ
2023-10-10 02:12:36 UTC
Permalink
Post by Aelius Gallus
Post by RinaldiJ
Curious. What does ifconfig tell you?
And cat /etc/rules.d/70-persistent-net.rules
Rinaldi
--------
bash-5.1$ ifconfig -a
eth126: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.11.2 netmask 255.255.255.0 broadcast 192.168.11.255
inet6 fe80::e967:c7e3:b350:3c21 prefixlen 64 scopeid 0x20<link>
ether 74:2b:62:87:73:61 txqueuelen 1000 (Ethernet)
RX packets 58 bytes 31116 (30.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 134 bytes 11638 (11.3 KiB)
TX errors 1 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
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
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
-------
bash-5.1$ cat /etc/rules.d/70-persistent-net.rules
cat: /etc/rules.d/70-persistent-net.rules: No such file or directory
bash-5.1$
That should be /etc/udev/rules.d/70-persistent-net.rules Note the udev

And it should contain as a minimum:

# PCI device 0x8086:0x15b8 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="74:2b:62:87:73:61", ATTR{dev_id}=="0x0",
ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


The e1000e will be replaced by whatever your ethernet device is. The
ATTR address should be the MAC address of your ethernet adapter, shown
in ifconfig. The NAME="eth0" refers to the first ethernet device.

I don't know if this is editable but I'd try it.

Then season /etc/rc.d/rc.inet1.conf to taste ;-)

My stanza for eth0 is:

# IPv4 config options for eth0:
IPADDRS[0]="192.168.1.101/24"
USE_DHCP[0]=""
# IPv6 config options for eth0:
IP6ADDRS[0]=""
USE_SLAAC[0]=""
USE_DHCP6[0]=""
# Generic options for eth0:
DHCP_HOSTNAME[0]=""

which except for asking for a specific IP is the default.

Rinaldi
Chris Elvidge
2023-10-09 14:29:46 UTC
Permalink
Post by Aelius Gallus
Post by Chris Elvidge
Investigate /etc/rc.d/rc.inet1.conf
There are sections there for eth0, eth1, eth2 etc
USE_DHCP[X] should be 'yes' for any interface that needs dhcp
'ip a' (as root) will give you a list of interfaces on the machine.
IPADDRS[126]=""
USE_DHCP[126]="yes"
IP6ADDRS[126]=""
USE_SLAAC[126]=""
USE_DHCP6[126]=""
DHCP_HOSTNAME[126]=""
(Please see above follow-ups for the value eth126, instead of former eth2)
After restart, had to use, as before, the dhcpcd command to get an
IP address.
rc.inet1.conf has a max interfaces number
In rc.inet1 it defaults to 6 -- 126 is way outside this limit
It's not really maximum interfaces; eth0 to eth5 are the only ones
allowed by default

What does 'ip a | grep ^[0-6]' say?

Are you sure you deleted /etc/udev/rules.d/70-persistent-net.rules?
--
Chris Elvidge, England
MY BUTT DOES NOT DESERVE A WEBSITE
Aelius Gallus
2023-10-10 02:35:49 UTC
Permalink
Post by Chris Elvidge
rc.inet1.conf has a max interfaces number
In rc.inet1 it defaults to 6 -- 126 is way outside this limit
It's not really maximum interfaces; eth0 to eth5 are the only ones
allowed by default
What does 'ip a | grep ^[0-6]' say?
Are you sure you deleted /etc/udev/rules.d/70-persistent-net.rules?
Thank you for asking again this question. In fact I changed the name
of the file to "Original.70-persistent-net.rules", and kept it in
the same directory, just in case. After your question I removed the
file and left the directory completely empty, and restarted the
laptop. To my surprise, the laptop got its IP address and eth0 was
back again as shown below,
-----
bash-5.1$ ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.11.2 netmask 255.255.255.0 broadcast 192.168.11.255
inet6 fe80::762b:62ff:fe87:7361 prefixlen 64 scopeid 0x20<link>
ether 74:2b:62:87:73:61 txqueuelen 1000 (Ethernet)
RX packets 96 bytes 21827 (21.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 168 bytes 18004 (17.5 KiB)
TX errors 2 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
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
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

-----
Thank you to all of you for the tremendous support.
Henrik Carlqvist
2023-10-10 08:54:17 UTC
Permalink
In fact I changed the name of the file to
"Original.70-persistent-net.rules", and kept it in the same
directory, just in case.
As all the files in that directory is run in alphabetical order and
"Original" comes after "70" the contents of the original file overwrote
the contents of your new file modified for your new hardware. This also
explains why your eth0 got renamed to something else when Original wanted
to use eth0 for another interface.
After your question I removed the file and left
the directory completely empty, and restarted the laptop. To my
surprise, the laptop got its IP address and eth0 was back again
Without any 70-persistent-net.rules a new file will be created at next
reboot only listing interfaces in your current hardware setup. The first
ethernet interface found will be named eth0.

However, if you before also had some other more or less custom files in /
etc/udev/rules.d not related to networking you might want to keep them. I
usually place custom files there which allow me to access different
hardware as digital cameras and GPS navigators as a normal user.

regards Henrik
Aelius Gallus
2023-10-10 11:54:37 UTC
Permalink
Post by Henrik Carlqvist
As all the files in that directory is run in alphabetical order and
the contents of your new file modified for your new hardware. This also
explains why your eth0 got renamed to something else when Original wanted
to use eth0 for another interface.
After your question I removed the file and left
the directory completely empty, and restarted the laptop. To my
surprise, the laptop got its IP address and eth0 was back again
Without any 70-persistent-net.rules a new file will be created at next
reboot only listing interfaces in your current hardware setup. The first
ethernet interface found will be named eth0.
However, if you before also had some other more or less custom files in /
etc/udev/rules.d not related to networking you might want to keep them. I
usually place custom files there which allow me to access different
hardware as digital cameras and GPS navigators as a normal user.
regards Henrik
Thank you for your comprehensive comment. That explains the requirement
to have, in my particular case, the /etc/udev/rules.d directory empty.

The last paragraph in your comment, about digital cameras and GPS
navigators, looks well above my head. In fact, I am very much impressed
by the knowledge of the people in this newsgroup.
Jerry Peters
2023-10-11 23:14:28 UTC
Permalink
Post by Aelius Gallus
Post by Chris Elvidge
rc.inet1.conf has a max interfaces number
In rc.inet1 it defaults to 6 -- 126 is way outside this limit
It's not really maximum interfaces; eth0 to eth5 are the only ones
allowed by default
What does 'ip a | grep ^[0-6]' say?
Are you sure you deleted /etc/udev/rules.d/70-persistent-net.rules?
Thank you for asking again this question. In fact I changed the name
of the file to "Original.70-persistent-net.rules", and kept it in
the same directory, just in case. After your question I removed the
file and left the directory completely empty, and restarted the
laptop. To my surprise, the laptop got its IP address and eth0 was
back again as shown below,
Add the '.original' to the *end*, udev executes any file with a .rules
suffix, so it still got executed.

If you want to prevent the whole persistant net crud from running, put
an empty file named '75-persistent-net-generator.rules' in
/etc/udev/rules.d. The way udev works, a file in /etc/udev/rules.d
overrides the like named file in /lib/udev/rules.d.
Aelius Gallus
2023-10-12 05:37:12 UTC
Permalink
Post by Jerry Peters
Post by Aelius Gallus
Post by Chris Elvidge
rc.inet1.conf has a max interfaces number
In rc.inet1 it defaults to 6 -- 126 is way outside this limit
It's not really maximum interfaces; eth0 to eth5 are the only ones
allowed by default
What does 'ip a | grep ^[0-6]' say?
Are you sure you deleted /etc/udev/rules.d/70-persistent-net.rules?
Thank you for asking again this question. In fact I changed the name
of the file to "Original.70-persistent-net.rules", and kept it in
the same directory, just in case. After your question I removed the
file and left the directory completely empty, and restarted the
laptop. To my surprise, the laptop got its IP address and eth0 was
back again as shown below,
Add the '.original' to the *end*, udev executes any file with a .rules
suffix, so it still got executed.
Thank you, to let me know that.
Post by Jerry Peters
If you want to prevent the whole persistant net crud from running, put
an empty file named '75-persistent-net-generator.rules' in
/etc/udev/rules.d. The way udev works, a file in /etc/udev/rules.d
overrides the like named file in /lib/udev/rules.d.
I tried the empty file as suggested, and it also works.
All the comments in this thread is a revelation to me.
I wonder where you get all this knowledge. Thank you, once again.
root
2023-10-09 20:19:21 UTC
Permalink
Post by Aelius Gallus
My Dell laptop stopped working and I transferred its hard disk to another
one. Slackware-15.0 is working fine, except that it doesn't get its IP from
the router.
Every time I start Slackware, I have to get its IP address using the dhclient
or dhcpcd command with eth2 as a NIC number; it was eth0 before, but this is
not a problem. How can I correct this situation?
Any help will be appreciated.
cd to /etc/udev/rules.d
and delete the 70-* files
reboot
that will restore you eth0. Right now your eth1
is probably active.
Aelius Gallus
2023-10-10 02:41:55 UTC
Permalink
Post by root
Post by Aelius Gallus
My Dell laptop stopped working and I transferred its hard disk to another
one. Slackware-15.0 is working fine, except that it doesn't get its IP from
the router.
Every time I start Slackware, I have to get its IP address using the
dhclient or dhcpcd command with eth2 as a NIC number; it was eth0 before,
but this is not a problem. How can I correct this situation?
Any help will be appreciated.
cd to /etc/udev/rules.d
and delete the 70-* files
reboot
that will restore you eth0. Right now your eth1
is probably active.
Thank you. The problem has been solved as you suggest, by deleting the
"70-*" file.
Loading...