View previous topic :: View next topic |
Author |
Message |
thegrind n00b
Joined: 22 Sep 2024 Posts: 14
|
Posted: Wed Nov 06, 2024 5:12 am Post subject: Giving wlan0 priority over eth0 |
|
|
I have installed Gentoo on my RPi5. The Pi has a connection for the ethernet cable and wifi. I have them both connected and they both have different local ips so for example eth0 has 192.168.1.10 and wlan0 has 192.168.1.11. My wifi connection is faster so I would like to use this is as the default interface but every time I boot it defaults to eth0. Does anyone know how I can set this up. I did it before with NetworkManager by using nmcli and setting a priority so I'd like to see if I could do something similar with iwd instead of having to switch to NM. |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1229 Location: Richmond Hill, Canada
|
Posted: Wed Nov 06, 2024 7:19 am Post subject: |
|
|
Have you tried with nmcli?
I don't use wifi for my rpi5, but nmcli does show Code: | rpi5 ~ # nmcli
end0: connected to Wired connection 1
"end0"
ethernet (macb), 2C:xx:xx:xx:xx:xx, hw, mtu 1500
ip4 default
inet4 192.168.xx.xx/24
route4 192.168.xx.0/24 metric 100
route4 default via 192.168.xx.xx metric 100
docker0: connected (externally) to docker0
"docker0"
bridge, 02:42:C0:5D:C6:4F, sw, mtu 1500
inet4 172.17.0.1/16
route4 172.17.0.0/16 metric 0
inet6 fe80::42:c0ff:fe5d:c64f/64
route6 fe80::/64 metric 256
lo: connected (externally) to lo
"lo"
loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536
inet4 127.0.0.1/8
inet6 ::1/128
wlan0: unavailable
"Broadcom Wi-Fi"
wifi (brcmfmac), xx:xx:xx:xx:xx:xx, sw disabled, hw, mtu 1500
DNS configuration:
servers: 192.168.xx.xx
domains: home
interface: end0
Use "nmcli device show" to get complete information about known devices and
"nmcli connection show" to get an overview on active connection profiles.
Consult nmcli(1) and nmcli-examples(7) manual pages for complete usage details.
rpi5 ~ # |
And networkcli show Code: | rpi5 ~ # networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback - unmanaged
2 end0 ether - unmanaged
3 wlan0 wlan - unmanaged
4 docker0 bridge - unmanaged
4 links listed. |
|
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3412
|
Posted: Wed Nov 06, 2024 9:01 am Post subject: |
|
|
1) Why not just unplug the wire if you don't want to use it anyway?
2) What do you use to manage wired connection? I though iwd handles wireless part and is a replacement for wpa_supplicant rather than networkmanager, am I wrong about it? _________________ Make Computing Fun Again |
|
Back to top |
|
|
thegrind n00b
Joined: 22 Sep 2024 Posts: 14
|
Posted: Thu Nov 07, 2024 1:56 am Post subject: |
|
|
pingtoo wrote: | Have you tried with nmcli?
I don't use wifi for my rpi5, but nmcli does show Code: | rpi5 ~ # nmcli
end0: connected to Wired connection 1
"end0"
ethernet (macb), 2C:xx:xx:xx:xx:xx, hw, mtu 1500
ip4 default
inet4 192.168.xx.xx/24
route4 192.168.xx.0/24 metric 100
route4 default via 192.168.xx.xx metric 100
docker0: connected (externally) to docker0
"docker0"
bridge, 02:42:C0:5D:C6:4F, sw, mtu 1500
inet4 172.17.0.1/16
route4 172.17.0.0/16 metric 0
inet6 fe80::42:c0ff:fe5d:c64f/64
route6 fe80::/64 metric 256
lo: connected (externally) to lo
"lo"
loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536
inet4 127.0.0.1/8
inet6 ::1/128
wlan0: unavailable
"Broadcom Wi-Fi"
wifi (brcmfmac), xx:xx:xx:xx:xx:xx, sw disabled, hw, mtu 1500
DNS configuration:
servers: 192.168.xx.xx
domains: home
interface: end0
Use "nmcli device show" to get complete information about known devices and
"nmcli connection show" to get an overview on active connection profiles.
Consult nmcli(1) and nmcli-examples(7) manual pages for complete usage details.
rpi5 ~ # |
And networkcli show Code: | rpi5 ~ # networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback - unmanaged
2 end0 ether - unmanaged
3 wlan0 wlan - unmanaged
4 docker0 bridge - unmanaged
4 links listed. |
|
I didn't install NetworkManager on this install thus I don't have nmcli as I am just using iwd. I had it working on my previous microsd with NM as it was fairly easy. The problem I've been having with the PI5 on both Arch (using wpa_supplicant) and Getntoo (NM) is the network interfaces freezing up randomly. Sometimes after a half day sometimes after a couple of days. I would like to try to make it work with iwd but I'm not sure if this is doable. |
|
Back to top |
|
|
thegrind n00b
Joined: 22 Sep 2024 Posts: 14
|
Posted: Thu Nov 07, 2024 2:01 am Post subject: |
|
|
szatox wrote: | 1) Why not just unplug the wire if you don't want to use it anyway?
2) What do you use to manage wired connection? I though iwd handles wireless part and is a replacement for wpa_supplicant rather than networkmanager, am I wrong about it? |
1. It seems any large emerge doesn't do well with wifi so I like to keep plugged in and then I can just up or down the network interface I don't want to use.
2. I'm not sure what manages eth0. Naturally the wifi is managed by iwd. This is probably why I can't set a priority since they are two different managers. I'll just try to work off wifi and see how it goes or buy a new wall outlet ethernet connection with a high speed one as my current one is 100MB/sec |
|
Back to top |
|
|
flexibeast Guru
Joined: 04 Apr 2022 Posts: 433 Location: Naarm/Melbourne, Australia
|
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3412
|
Posted: Thu Nov 07, 2024 8:51 am Post subject: |
|
|
Well, the rules for selecting the outgoing interface go like this:
1 Find all interfaces with routing rules containing the destination
2 Order them by mask (longer mask = higher priority)
3 Break ties with metrics (lower cost/number = higher priority)
Wifi's default metric is like 600, and ethernet's default metric depends on interface speed, but will always be lower. And here comes trick from OpenVPN:
add 2 routes to your wifi, to 0.0.0.0/1 and 128.0.0.0/1
Those will override the default gateway ( 0/0 ) regardless of metrics. And you can do the same with ipv6 address space. It is a bit of a hack, but other things are unlikely to mess this setup up even if they try.
Quote: | I'm not sure what manages eth0 | Ah, I'm not sure what. Yes, this one is known to cause problems.
Quote: | It seems any large emerge doesn't do well with wifi |
That's weird. Can you explain that part more? This also looks like the actual problem you should be solving instead of doing workarounds on your network. What's going wrong there?
One thing that comes to my mind is that maybe your power supply is not strong enough to radiate power while spinning all cores at full throttle. _________________ Make Computing Fun Again |
|
Back to top |
|
|
|
|
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
|
|