View previous topic :: View next topic |
Author |
Message |
luckylinux n00b
Joined: 17 Mar 2012 Posts: 48
|
Posted: Wed May 06, 2020 7:08 pm Post subject: Using *any* network interface |
|
|
Due to heterogeneous network setup, I would like to be able to simply use *any* network interfaces on the current system to connect to the internet.
I have some ideas in mind but I am not sure if they can actually be implemented (mostly due to OpenRC init scripts).
1. Use /etc/rc.local. This is what I use in some Debian LiveUSB. Simply put "dhclient -v" in the file and every time I boot in any machine, I just check the DHCP server to see the IP of the remote machine containing the USB key.
2. Add every network interface starting with e* (ens, enp, ...) to a network bridge, setup priorities and setup the bridge to start automatically at startup.
3. Use legacy names (udev), i.e. eth0 eth1 ...
Unfortunately between the different machines I have it's already difficult enough to standardize the network adapter (ens, enp, ...) but also the number (12,16,18,20) that needs to be used. This can also change due to kernel updates. The ideal solution would be to use approach 1., except in some instances I want a static IP (not configured through the DHCP server). In the case of approach 3. it always assumes that eth0 for instance is always up, whereas I have some virtual machines where some network adapters are available but not connected to any outdoors network (e.g. only used when I need them, disconnect afterwards).
What would you reccomend? Is there a "reccomended" Gentoo way to solve such issue? Or is there even a deamon that automatically handles such things (such as dhclient)? |
|
Back to top |
|
|
dr_wulsen Tux's lil' helper
Joined: 21 Aug 2013 Posts: 146 Location: Austria
|
Posted: Wed May 06, 2020 7:35 pm Post subject: |
|
|
could ifplugd help you?
It says here that it somewhat supports an interface auto-detection.
However, far as I know it's designed for Ethernet interfaces and cable detection, so if "heterogeneous" includes wifi interfaces, they may have to be handled separately. _________________ There's no stupid questions, only stupid answers. |
|
Back to top |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3685
|
Posted: Wed May 06, 2020 9:27 pm Post subject: Re: Using *any* network interface |
|
|
luckylinux wrote: | What would you reccomend? Is there a "reccomended" Gentoo way to solve such issue? Or is there even a deamon that automatically handles such things (such as dhclient)? |
Have you tried iwd? |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
luckylinux n00b
Joined: 17 Mar 2012 Posts: 48
|
Posted: Thu May 07, 2020 3:09 am Post subject: |
|
|
Thank you all for the answers.
I should have probably specified it more clearly.
By "heterogeneous" I was more focused on different ethernet drivers, specifically optimized for server, including (and mostly) virtualized environments:
- Intel
- Realtek
- VMWare VMXNET3
- KVM Virtio
@dr_wulsen
It looks as ifplugd could in principle do it. Although it seems deprecated. Did it get integrated into Systemd and deprecated by its original author ?
@charles17
I have a few machines where I have wireless connectivity as well, and it those cases iwd could be used. Where I have wireless support that being said I usually just use Networkmanager with the Gnome/MATE applet.
@UberLord
Thank you for your suggestion! I usually used dhclient on my machines but it seems that is not available on Gentoo. Dhcpd seems to be quite small and provide "just enough" configuration support according to https://wiki.gentoo.org/wiki/Dhcpcd and https://forums.gentoo.org/viewtopic-t-685913.html. Do you have any insights on this? It's nice that one can also configure static IP address on the machine itself.
In general: would you reccomend to always use DHCP server and set up static IP assignment there, or always use static IPs directly on the client? Right now I have a 50%-50% setup which of course isn't very easy to maintain. My home router is OPNSense, although I suppose in the future I will just "redirect" / "reassign" the DHCP role (master DHCP server ?) to a Gentoo Box. That way it would be easier to script the process instead of always manually configuring static IPs through the web interface. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Thu May 07, 2020 8:42 am Post subject: |
|
|
luckylinux wrote: | I should have probably specified it more clearly.
By "heterogeneous" I was more focused on different ethernet drivers, specifically optimized for server, including (and mostly) virtualized environments:
- Intel
- Realtek
- VMWare VMXNET3
- KVM Virtio
|
dhcpcd won't care about that.
It only cares that setting IFF_UP is enough to bring the interface up if not already up.
Quote: |
@UberLord
Thank you for your suggestion! I usually used dhclient on my machines but it seems that is not available on Gentoo. Dhcpd seems to be quite small and provide "just enough" configuration support according to https://wiki.gentoo.org/wiki/Dhcpcd and https://forums.gentoo.org/viewtopic-t-685913.html. Do you have any insights on this? It's nice that one can also configure static IP address on the machine itself. |
dhclient is found in the net/dhcp ebuild using the client USE flag.
Not that I recommend using it. ISC have abandoned it.
Well, I am the maintainer for dhcpcd (outside of Gentoo, biut I don't think any ebuilds have patches not upstreamed).
Your linked topic is from 2008 - it's now 2020 and I release new dhcpcd builds pretty regulary so that's waaaaay out of date.
What specific insight do you need?
Quote: |
In general: would you reccomend to always use DHCP server and set up static IP assignment there, or always use static IPs directly on the client? Right now I have a 50%-50% setup which of course isn't very easy to maintain. My home router is OPNSense, although I suppose in the future I will just "redirect" / "reassign" the DHCP role (master DHCP server ?) to a Gentoo Box. That way it would be easier to script the process instead of always manually configuring static IPs through the web interface. |
Easier to maintain addresses on the DHCP server.
As dhcpcd sends the hostname option to the server as well, the DHCP server could also dynamically update DNS (if say the server is dnsmasq) and then you don't even need to manage the host -> macaddress -> address -> mappings yourself. _________________ Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool |
|
Back to top |
|
|
dr_wulsen Tux's lil' helper
Joined: 21 Aug 2013 Posts: 146 Location: Austria
|
Posted: Thu May 07, 2020 4:02 pm Post subject: |
|
|
Quote: | dr_wulsen
It looks as ifplugd could in principle do it. Although it seems deprecated. Did it get integrated into Systemd and deprecated by its original author ? | I'm not sure, but that could be easily the case - is there anything that systemd won't take over and make depend on systmed itself?
I don't know about any successor to it, sorry. _________________ There's no stupid questions, only stupid answers. |
|
Back to top |
|
|
luckylinux n00b
Joined: 17 Mar 2012 Posts: 48
|
Posted: Fri May 08, 2020 4:19 pm Post subject: |
|
|
Thank you for your explanation, @UberLord.
UberLord wrote: |
dhcpcd won't care about that.
It only cares that setting IFF_UP is enough to bring the interface up if not already up.
|
If there are multiple interfaces, is there be a way to set some preference on which one to use (e.g. prefer 10gbit over 1gbit interfaces)?
Does dhcpcd bring up all interfaces it finds or it's more of a first-in-first-served kind of approach?
UberLord wrote: |
Quote: |
In general: would you reccomend to always use DHCP server and set up static IP assignment there, or always use static IPs directly on the client? Right now I have a 50%-50% setup which of course isn't very easy to maintain. My home router is OPNSense, although I suppose in the future I will just "redirect" / "reassign" the DHCP role (master DHCP server ?) to a Gentoo Box. That way it would be easier to script the process instead of always manually configuring static IPs through the web interface. |
Easier to maintain addresses on the DHCP server.
As dhcpcd sends the hostname option to the server as well, the DHCP server could also dynamically update DNS (if say the server is dnsmasq) and then you don't even need to manage the host -> macaddress -> address -> mappings yourself. |
Well at some point I need to manage the MAC -> IP address, but I get what you mean. Right now I would anyway to add an entry for each host to manually configure the DNS.
Well the plan is to use BASH + Salt to automatically generate it (either from a Database or from an EXCEL file, where MAC - IP - Hostname are defined).
The only point to consider when going full-DHCP is ... what happens if the DHCP server fails. Already had it happen on some occasions (e.g. excessive memory usage on virtualization host, causing crashes) so some key hosts will need to stay Static IP I assume (e.g. main NAS, DNS Servers, Router, DHCP Servers). |
|
Back to top |
|
|
|