1 |
On Wednesday 13 April 2011 18:07:30 Indi wrote: |
2 |
> On Wed, Apr 13, 2011 at 06:10:05PM +0200, Mick wrote: |
3 |
> > On 13 April 2011 16:35, Indi <thebeelzebubtrigger@×××××.com> wrote: |
4 |
> > > On Wed, Apr 13, 2011 at 01:50:02PM +0200, deadeyes wrote: |
5 |
> > >> I was searching around the gentoo forums for ifmetric and found this |
6 |
> > >> piece of 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 |
> > > Hey, that works very well here -- thanks! |
20 |
> > > Been wanting that solution for some time now. |
21 |
> > > |
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 |
> Actually I do want to prioritise one over the other, when both are |
37 |
> connected. Using netplug with one wired and one wireless, and the |
38 |
> referenced script in /etc/conf.d/net. |
39 |
> |
40 |
> Am I doing it wrong? :) |
41 |
|
42 |
No, not at all. It's only that the OP wanted to prioritise the wired |
43 |
interface against the wireless, but *only* for connections to the LAN. |
44 |
-- |
45 |
Regards, |
46 |
Mick |