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