* [gentoo-user] configure wlan0 route metric
@ 2011-04-12 21:14 deadeyes
2011-04-13 9:33 ` Kfir Lavi
0 siblings, 1 reply; 8+ messages in thread
From: deadeyes @ 2011-04-12 21:14 UTC (permalink / raw
To: gentoo-user
Hi all,
For my home network I am generally using wireless to get connected to the
network and the internet.
However for copying some large files I use the wire.
That means I get 2 IPs in the same range.
And both interfaces get the same metric : 0.
I found out I can modify the metric for the default route using metric_wlan0.
Code:
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
0.0.0.0 192.168.1.1 0.0.0.0 UG 2 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 wlan0
(this is not the full routing table)
However this changes the metric of the default route.
Not of the route that is specifically for the local network.
of course I can do this manually.
However that is alot of hassle and seems to be something that should be
configurable use files.
Does anyone knows how I can accomplish this? Or how I can change the metric for
each route for the wlan0 interface?
Thanks in advance!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] configure wlan0 route metric
2011-04-12 21:14 [gentoo-user] configure wlan0 route metric deadeyes
@ 2011-04-13 9:33 ` Kfir Lavi
2011-04-13 10:06 ` [gentoo-user] " deadeyes
0 siblings, 1 reply; 8+ messages in thread
From: Kfir Lavi @ 2011-04-13 9:33 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1850 bytes --]
On Wed, Apr 13, 2011 at 12:14 AM, deadeyes <gvm999@gmail.com> wrote:
> Hi all,
>
> For my home network I am generally using wireless to get connected to the
> network and the internet.
>
> However for copying some large files I use the wire.
>
> That means I get 2 IPs in the same range.
> And both interfaces get the same metric : 0.
>
> I found out I can modify the metric for the default route using
> metric_wlan0.
> Code:
>
> Destination Gateway Genmask Flags Metric Ref Use
> Iface
> 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0
> eth0
> 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0
> wlan0
> 0.0.0.0 192.168.1.1 0.0.0.0 UG 2 0 0
> eth0
> 0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0
> wlan0
>
> (this is not the full routing table)
> However this changes the metric of the default route.
> Not of the route that is specifically for the local network.
> of course I can do this manually.
> However that is alot of hassle and seems to be something that should be
> configurable use files.
>
> Does anyone knows how I can accomplish this? Or how I can change the metric
> for
> each route for the wlan0 interface?
>
> Thanks in advance!
>
>
> Hi,
you can use net-analyzer/ifmetric.
I found this solution not satisfying, but don't remember why.
I guess some corner cases.
I have bonded the interfaces on my laptop. The bonding driver will prefer
using the wired when
it is connected.
Here is my /etc/conf.d/net:
# eth0
config_eth0=( "null" )
# wlan
modules=( "wpa_supplicant" )
wpa_supplicant_wlan0="-Dwext"
config_wlan0=( "null" )
modules_wlan0=( "!plug" )
ifplugd_wlan0="--api-mode=wlan"
# bond
slaves_bond0="eth0 wlan0"
dhcpcd_bond0="--noipv4ll --nolink -t 15"
config_bond0=( "dhcp" )
Regards,
Kfir
[-- Attachment #2: Type: text/html, Size: 2485 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [gentoo-user] Re: configure wlan0 route metric
2011-04-13 9:33 ` Kfir Lavi
@ 2011-04-13 10:06 ` deadeyes
2011-04-13 11:20 ` Mick
0 siblings, 1 reply; 8+ messages in thread
From: deadeyes @ 2011-04-13 10:06 UTC (permalink / raw
To: gentoo-user
Kfir Lavi <lavi.kfir <at> gmail.com> writes:
> Hi,you can use net-analyzer/ifmetric.I found this solution not satisfying, but
> don't remember why. I guess some corner cases. I have bonded the interfaces on
> my laptop. The bonding driver will prefer using the wired when
>
> it is connected. Here is my /etc/conf.d/net:# eth0config_eth0=( "null" )#
> wlanmodules=( "wpa_supplicant" )wpa_supplicant_wlan0="-Dwext"config_wlan0=(
> "null" )
>
> modules_wlan0=( "!plug" )ifplugd_wlan0="--api-mode=wlan"#
> bondslaves_bond0="eth0 wlan0"dhcpcd_bond0="--noipv4ll --nolink -t
> 15"config_bond0=( "dhcp" )Regards,Kfir
>
Thanks for your response!
Bonding doesn't seem a good solution for me.
I can't find documentation on ifmetric.
Do I need ifplugd to call ifmetric? or can I configure this in /etc/conf.d/net?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] Re: configure wlan0 route metric
2011-04-13 10:06 ` [gentoo-user] " deadeyes
@ 2011-04-13 11:20 ` Mick
2011-04-13 11:40 ` deadeyes
0 siblings, 1 reply; 8+ messages in thread
From: Mick @ 2011-04-13 11:20 UTC (permalink / raw
To: gentoo-user
On 13 April 2011 11:06, deadeyes <gvm999@gmail.com> wrote:
> Thanks for your response!
> Bonding doesn't seem a good solution for me.
> I can't find documentation on ifmetric.
> Do I need ifplugd to call ifmetric? or can I configure this in /etc/conf.d/net?
You can define the priority in your /etc/conf.d/net
You can set this per wired/wireless interface; e.g.
metric_eth0="100"
Look at your /etc/conf.d/net.example for more details.
HTH.
--
Regards,
Mick
^ permalink raw reply [flat|nested] 8+ messages in thread
* [gentoo-user] Re: configure wlan0 route metric
2011-04-13 11:20 ` Mick
@ 2011-04-13 11:40 ` deadeyes
2011-04-14 8:13 ` deadeyes
0 siblings, 1 reply; 8+ messages in thread
From: deadeyes @ 2011-04-13 11:40 UTC (permalink / raw
To: gentoo-user
Mick <michaelkintzios <at> gmail.com> writes:
>
> You can define the priority in your /etc/conf.d/net
>
> You can set this per wired/wireless interface; e.g.
>
> metric_eth0="100"
>
> Look at your /etc/conf.d/net.example for more details.
>
> HTH.
No offense, I had found out about this option (and tried it already):
"I found out I can modify the metric for the default route using metric_wlan0."
This however only changes the default route. Not the route for the local network
route.
Also metric_eth0 would give less priority to my wired network, which is not what
I want.
I was searching around the gentoo forums for ifmetric and found this piece of
code that can be added in /etc/conf.d/net:
postup() {
local metric=0
case "${IFACE}" in
eth0) metric=0 ;;
eth1) metric=1 ;;
esac
ifmetric "${IFACE}" "${metric}"
return 0
}
I'll try as soon as I can and add my experience with this.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [gentoo-user] Re: configure wlan0 route metric
2011-04-13 11:40 ` deadeyes
@ 2011-04-14 8:13 ` deadeyes
2011-04-14 9:53 ` Mick
0 siblings, 1 reply; 8+ messages in thread
From: deadeyes @ 2011-04-14 8:13 UTC (permalink / raw
To: gentoo-user
deadeyes <gvm999 <at> gmail.com> writes:
code that can be added in /etc/conf.d/net:
postup() {
local metric=0
case "${IFACE}" in
eth0) metric=0 ;;
eth1) metric=1 ;;
esac
ifmetric "${IFACE}" "${metric}"
return 0
}
Seems like this works for me as well! :)
Thanks for your responses guys
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] Re: configure wlan0 route metric
2011-04-14 8:13 ` deadeyes
@ 2011-04-14 9:53 ` Mick
2011-04-14 20:22 ` deadeyes
0 siblings, 1 reply; 8+ messages in thread
From: Mick @ 2011-04-14 9:53 UTC (permalink / raw
To: gentoo-user
On 14 April 2011 09:13, deadeyes <gvm999@gmail.com> wrote:
> deadeyes <gvm999 <at> gmail.com> writes:
>
> code that can be added in /etc/conf.d/net:
> postup() {
> local metric=0
>
> case "${IFACE}" in
> eth0) metric=0 ;;
> eth1) metric=1 ;;
> esac
> ifmetric "${IFACE}" "${metric}"
>
> return 0
> }
>
> Seems like this works for me as well! :)
It does? I assume that eth1 above is wlan0 in your case.
If you restart both eth0 and wlan0 so as to zero the packet counters,
then start a download/upload from your a machine in your LAN, what
packet counts do you get in ifconfig for each NIC?
--
Regards,
Mick
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-04-14 20:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-12 21:14 [gentoo-user] configure wlan0 route metric deadeyes
2011-04-13 9:33 ` Kfir Lavi
2011-04-13 10:06 ` [gentoo-user] " deadeyes
2011-04-13 11:20 ` Mick
2011-04-13 11:40 ` deadeyes
2011-04-14 8:13 ` deadeyes
2011-04-14 9:53 ` Mick
2011-04-14 20:22 ` deadeyes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox