1 |
On 13 April 2011 16:35, Indi <thebeelzebubtrigger@×××××.com> wrote: |
2 |
> On Wed, Apr 13, 2011 at 01:50:02PM +0200, deadeyes wrote: |
3 |
>> |
4 |
>> I was searching around the gentoo forums for ifmetric and found this piece of |
5 |
>> code that can be added in /etc/conf.d/net: |
6 |
>> postup() { |
7 |
>> local metric=0 |
8 |
>> |
9 |
>> case "${IFACE}" in |
10 |
>> eth0) metric=0 ;; |
11 |
>> eth1) metric=1 ;; |
12 |
>> esac |
13 |
>> ifmetric "${IFACE}" "${metric}" |
14 |
>> |
15 |
>> return 0 |
16 |
>> } |
17 |
>> |
18 |
> |
19 |
> Hey, that works very well here -- thanks! |
20 |
> Been wanting that solution for some time now. |
21 |
> :) |
22 |
|
23 |
My apologies! It took some time between reading your message and |
24 |
replying to it - by which time I had forgotten the finer points. |
25 |
|
26 |
Whether you set NIC priority in the /etc/conf.d/net file or in a post |
27 |
up script, the result is the same. One NIC will have a higher |
28 |
priority than another for ALL connections. This is because NICs do |
29 |
not do NATing. They will send all packets out to the gateway |
30 |
(192.168.1.1) and the router at the gateway will determine which |
31 |
packet is forwarded to the Internet and which to the LAN. So, if you |
32 |
do not want to prioritise one NIC over another, it may be better to |
33 |
use iptables to route LAN packets via a particular NIC instead. |
34 |
|
35 |
-- |
36 |
Regards, |
37 |
Mick |