LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-27-2018, 02:11 PM   #1
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Rep: Reputation: 28
Setting inet address on new host


New host running 14.2/x86_64.

Kernel routing table has correct default route and gateway.

/etc/rc.d/rc.inet1.conf has both eth0 and eth1 (which is what ifconfig has as the Ethernet interface) set to 192.168.55.7 with netmask 255.255.255.0.

ifconfig -a shows the lo and eth1 configurations, with the latter UP and RUNNING. But, it has only an inet6 address and not an ipv4 address.

How do I add the ipv4 address to eth1?
 
Old 09-27-2018, 02:35 PM   #2
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Quote:
Originally Posted by rshepard View Post
/etc/rc.d/rc.inet1.conf has both eth0 and eth1 (which is what ifconfig has as the Ethernet interface) set to 192.168.55.7 with netmask 255.255.255.0.
You want to have the same ipv4 IP Address on both eth0 and eth1 ?
If positive, here some lecture:
https://superuser.com/questions/3368...dress-for-both
https://unix.stackexchange.com/quest...sical-networks
 
Old 09-27-2018, 04:43 PM   #3
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Original Poster
Rep: Reputation: 28
abga,

It's not that I want the same ipv4 IP address on both eth0 and eth1, but this is the first time in in more than 20 years that the default interface has been eth1 and not eth0.The system is not seeing eth0, only eth1. Why this is I have no idea.

But, I did add the ipv4 IP address by running '/etc/rc.d/rc.inet1 eth1_start' which I've not before needed to do. Now this host sees other hosts on the LAN and can reach outside the network.

Thanks,

Rich
 
Old 09-27-2018, 04:56 PM   #4
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Occasionally (and recently) I'm also struggling to order multiple Ethernet adapters and started to make a habit out of editing the:
/etc/udev/rules.d/70-persistent-net.rules
Code:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="XX:XX:XX:XX:XX:XX", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="YY:YY:YY:YY:YY:YY", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# .. etc.
 
Old 09-28-2018, 10:38 AM   #5
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by abga View Post
Occasionally (and recently) I'm also struggling to order multiple Ethernet adapters and started to make a habit out of editing the:
/etc/udev/rules.d/70-persistent-net.rules
Code:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="XX:XX:XX:XX:XX:XX", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="YY:YY:YY:YY:YY:YY", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# .. etc.
abga,

How interesting! Please confirm my understanding; that is, I can edit /etc/udev/rules.d/70-persistent-net.rules and add the above line for eth0 (ignoring the one for eth1) and then reset rc.inet1 and inet1.conf to use eth0. This would be consistent with all other hosts I've used.

Thanks,

Rich
 
Old 09-28-2018, 12:33 PM   #6
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Original Poster
Rep: Reputation: 28
abga,

I just checked 70-persistent-net.rules. It was similar to the above, but has the MAC address (6 octal numbers) as well as two extra key/value pairs: KERNEL=="eth*", NAME=="eth0"

So it looks like only eth0 is defined, yet the system is seeing eth1 instead.

I just tried changing the Ethernet interface to 0, but after changing rc.inet1.conf, rc.inet1, and restarting rc.inetd I could not bring up eth0. ifconfig told me there is no such device on this Asus Prime X470-Pro motherboard. Sigh.

I'll learn to live with this one host using eth1 while everyone else uses eth0.

Thanks for your suggestions,

Rich
 
Old 09-28-2018, 01:03 PM   #7
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by rshepard View Post
I just checked 70-persistent-net.rules. It was similar to the above, but has the MAC address (6 octal numbers) as well as two extra key/value pairs: KERNEL=="eth*", NAME=="eth0"

So it looks like only eth0 is defined, yet the system is seeing eth1 instead.
Does the MAC address in that file match the MAC address of your card? If not, then eth0 is being reserved for the MAC address specified in that entry and your device would never get it. If it doesn't match, try replacing the MAC address in that file with the one from your device.

If it does match, then I'm not sure what could be causing the problem. You could try and change the logging levels of udev to hopefully allow some additional logging to give you some hints on why it isn't working. Supposedly you can change the running udev logging using udevadm control --log-priority=info, however, I'm not sure the easiest way to get udev to try and assign names again... maybe rmmod-ing and then modprobe-ing the module for that device. You should also be able to change the default log level in /etc/udev.conf, but I don't have a computer in front of me to look at the file. Changing the logging should allow output to /var/log/syslog and/or dmesg.
 
Old 09-28-2018, 01:36 PM   #8
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@rshepard
Quote:
How interesting! Please confirm my understanding; that is, I can edit /etc/udev/rules.d/70-persistent-net.rules and add the above line for eth0 (ignoring the one for eth1) and then reset rc.inet1 and inet1.conf to use eth0. This would be consistent with all other hosts I've used.
Yes, you're right, if you edit /etc/udev/rules.d/70-persistent-net.rules and add only the line for eth0 providing its actual MAC Address, it'll instruct udevd to name that interface as eth0 on the next boot. Cannot guarantee how the other Ethernet adapters will be named, thus, it's recommended to care about all of them in /etc/udev/rules.d/70-persistent-net.rules.
This is ordering the interfaces based on their MAC addresses as unique identifiers, but there are other options too. You can order them based on the PCI/PCIe slot they're connected to, check with lspci, like here:
https://www.linuxquestions.org/quest...ml#post5859800
You could also make use of these two utilities:
https://linux.die.net/man/8/nameif
https://linux.die.net/man/8/ifrename

Quote:
I just checked 70-persistent-net.rules. It was similar to the above, but has the MAC address (6 octal numbers) as well as two extra key/value pairs: KERNEL=="eth*", NAME=="eth0"

So it looks like only eth0 is defined, yet the system is seeing eth1 instead.
In post #4 I presented a sample, XX:XX:XX:XX:XX:XX, YY:YY:YY:YY:YY:YY, etc. should be substituted with the actual MAC Addresses of the adapters and, as mentioned above, configure a rule for all available Ethernet adapters, that way udevd won't mess things up.
As bassmadrigal advised, you can increase the verbosity of the udevd daemon, but the interface renaming should be visible in dmesg even without this verbosity increase. Look for lines like:
Code:
udev: renamed network interface eth0 to eth1
 
Old 09-28-2018, 02:09 PM   #9
perbh
Member
 
Registered: May 2008
Location: Republic of Texas
Posts: 393

Rep: Reputation: 81
Typically, this kind of things happens if you move a disk from one computer to another (or if you change the eth-adapter). The old net-rule is still there, but now there is a new mac-address. The vast majority of my rigs have only one eth-adapter, but I do move disks between machines ... My solution is to delete 70-persistent-net.rule on each power-off (/etc/rc.d/rc.local_shutdown). Then, on reboot, the only adapter will be eth0 and it will be the right one.
 
Old 09-28-2018, 02:44 PM   #10
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
That's what I also do on Slackware ARM, where I have a SDCard image that I clone and then adapt the system configuration, but valid when I only have one Ethernet adapter.
 
Old 09-29-2018, 09:26 AM   #11
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 435

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by bassmadrigal View Post
Does the MAC address in that file match the MAC address of your card? If not, then eth0 is being reserved for the MAC address specified in that entry and your device would never get it. If it doesn't match, try replacing the MAC address in that file with the one from your device.
Looking at 'ifconfig -a' I found the MAC address to be 0c:9d:92:83:63:27. That's not the address in 70-persistent-net.rules, so I changed it. Then I modified rc.inet1.conf by uncommenting the IP address and netmask for eth0 and commenting out the IP address and netmask for eth1. Then I ran 'rc.inet1 start_eth0' and 'rc.inetd restart'.

As a user I pinged www.google.com and connected without delay.

Looking again at ifconfig the ethernet interface is still eth1. When I tried 'ifconfig eth0 up' the kernel again replied that no such device existed.

Does this make any sense to either of you?

Thanks,

Rich
 
Old 09-29-2018, 12:52 PM   #12
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
I think you would either need to rmmod the module for the device and then modprobe it again or simply reboot for it to try and reassign that device a name.
 
Old 09-29-2018, 04:02 PM   #13
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Rebooting is the easiest way to to sort things out.
Before that, you might want to run:
Code:
dmesg | grep eth
and look after your driver(s) recognizing and detailing the interfaces, something like:
Code:
r8169 0000:06:00.0 eth0: RTL8106e at 0xfffffffffffffffff, XX:XX:XX:XX:XX:XX, XID 03600000 IRQ 42
Out of the record above you can read the PCI(e) position 0000:06:00.0 and the MAC Address XX:XX:XX:XX:XX:XX, both helping you in understanding over which interface is which.
 
Old 10-03-2018, 01:14 PM   #14
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,753

Rep: Reputation: Disabled
FWIW one could match by 'dev_id' only and it'd still do the job. I never match by 'address' and if there's only one nic, I change eth* to eth0 like:
Code:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth0", NAME="eth0"
Not sure if that helps your case, OP.
 
  


Reply

Tags
ipv4 address, networking, routing table



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BlackBerry has no inet address anymore lucmove Linux - Networking 2 06-14-2015 05:36 AM
ifconfig command not showing inet address barsaiyan Linux - Newbie 1 06-04-2012 03:27 PM
eth0 inet address not assigned at startup?? abolishtheun Slackware 2 04-30-2009 07:38 AM
eth0 no longer works; does not have inet address (Ubuntu 8.10) BigNate37 Linux - Networking 2 02-14-2009 06:25 PM
Java code to get inet address in linux qiye Programming 1 09-15-2004 01:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration