Gentoo Archives: gentoo-user

From: Indi <thebeelzebubtrigger@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: configure wlan0 route metric
Date: Wed, 13 Apr 2011 17:09:14
Message-Id: 20110413170730.GA3549@gaurahari
1 On Wed, Apr 13, 2011 at 06:10:05PM +0200, Mick wrote:
2 > On 13 April 2011 16:35, Indi <thebeelzebubtrigger@×××××.com> wrote:
3 > > On Wed, Apr 13, 2011 at 01:50:02PM +0200, deadeyes wrote:
4 > >>
5 > >> I was searching around the gentoo forums for ifmetric and found this piece of
6 > >> code that can be added in /etc/conf.d/net:
7 > >> postup() {
8 > >>    local metric=0
9 > >>
10 > >>    case "${IFACE}" in
11 > >>       eth0) metric=0 ;;
12 > >>       eth1) metric=1 ;;
13 > >>    esac
14 > >>    ifmetric "${IFACE}" "${metric}"
15 > >>
16 > >>    return 0
17 > >> }
18 > >>
19 > >
20 > > Hey, that works very well here -- thanks!
21 > > Been wanting that solution for some time now.
22 > > :)
23 >
24 > My apologies! It took some time between reading your message and
25 > replying to it - by which time I had forgotten the finer points.
26 >
27 > Whether you set NIC priority in the /etc/conf.d/net file or in a post
28 > up script, the result is the same. One NIC will have a higher
29 > priority than another for ALL connections. This is because NICs do
30 > not do NATing. They will send all packets out to the gateway
31 > (192.168.1.1) and the router at the gateway will determine which
32 > packet is forwarded to the Internet and which to the LAN. So, if you
33 > do not want to prioritise one NIC over another, it may be better to
34 > use iptables to route LAN packets via a particular NIC instead.
35 >
36 > --
37 > Regards,
38 > Mick
39
40 Actually I do want to prioritise one over the other, when both are
41 connected. Using netplug with one wired and one wireless, and the
42 referenced script in /etc/conf.d/net.
43
44 Am I doing it wrong? :)
45
46 --
47 /\ /\
48 <\ />
49 ^ caveat utilitor
50 'v-v'

Replies

Subject Author
Re: [gentoo-user] Re: configure wlan0 route metric Mick <michaelkintzios@×××××.com>