nslu2: two ethernets: one by default

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

nslu2: two ethernets: one by default

by Xan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Perhaps it's a too much simple question, but I don't know what achieve
that: In nslu2 I have two network devices: eth0 and wlan0 (wifi). I just
want that:

- nslu2 tries if eth0 is plugged. If it's, then all network connection
were established via eth0
- if eth0 is unplugged, then all network connection were established via
wlan0.

Now the first is done, but when I unplugged the eth0 I can't reach the
system (all packets loose)

Anyone could help me? I suspect that I have to touch the route table. Is
it true?
My route table is:

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use
Iface
localnet        *               255.255.0.0     U     0      0        0 eth0
localnet        *               255.255.0.0     U     0      0        0
wlan0
default         172.26.0.1      0.0.0.0         UG    0      0        0
wlan0
default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0

wlan0 has static ip 172.26.0.3 and eth0 has static ip 172.26.0.2

172.26.0.1 is the router (what has internet connectivity). I just want
to have local network connections between all other devices and my nslu2.


Thanks in advance,
Xan.


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two ethernets: one by default

by Lennart Sorensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 30, 2009 at 05:32:09PM +0100, Xan wrote:

> Hi,
>
> Perhaps it's a too much simple question, but I don't know what achieve  
> that: In nslu2 I have two network devices: eth0 and wlan0 (wifi). I just  
> want that:
>
> - nslu2 tries if eth0 is plugged. If it's, then all network connection  
> were established via eth0
> - if eth0 is unplugged, then all network connection were established via  
> wlan0.
>
> Now the first is done, but when I unplugged the eth0 I can't reach the  
> system (all packets loose)
>
> Anyone could help me? I suspect that I have to touch the route table. Is  
> it true?
> My route table is:
>
> # route
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use  
> Iface
> localnet        *               255.255.0.0     U     0      0        0 eth0
> localnet        *               255.255.0.0     U     0      0        0  
> wlan0
> default         172.26.0.1      0.0.0.0         UG    0      0        0  
> wlan0
> default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0
>
> wlan0 has static ip 172.26.0.3 and eth0 has static ip 172.26.0.2
>
> 172.26.0.1 is the router (what has internet connectivity). I just want  
> to have local network connections between all other devices and my nslu2.

Linux in general does not deal with ignoring routes just because an
interface is down.  Unix like systems never do.  Routers do.

You can configure them as different IP networks and use both, or you
have to get something like quagga involved to manage your routes with
link detect enabled.

--
Len Sorensen


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two ethernets: one by default

by Xan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>>
>> # route
>> Kernel IP routing table
>> Destination     Gateway         Genmask         Flags Metric Ref    Use  
>> Iface
>> localnet        *               255.255.0.0     U     0      0        0 eth0
>> localnet        *               255.255.0.0     U     0      0        0  
>> wlan0
>> default         172.26.0.1      0.0.0.0         UG    0      0        0  
>> wlan0
>> default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0
>>
>> wlan0 has static ip 172.26.0.3 and eth0 has static ip 172.26.0.2
>>
>> 172.26.0.1 is the router (what has internet connectivity). I just want  
>> to have local network connections between all other devices and my nslu2.
>>    
>
> Linux in general does not deal with ignoring routes just because an
> interface is down.  Unix like systems never do.  Routers do.
>  
So in theory I have correct route table for when I unplugged eth0?. In
theory, can I connect via wlan0? Is it true? What fails specifically?
> You can configure them as different IP networks and use both, or you
> have to get something like quagga involved to manage your routes with
> link detect enabled.
>
>  
Can you explain me more on that. These interfaces have different ip. Is
it not enougth?

Lennart, please, explain the details because I'm an ignorant user in
that field.

Xan.


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Xan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

En/na Lennart Sorensen ha escrit:

> On Fri, Oct 30, 2009 at 05:32:09PM +0100, Xan wrote:
>  
>> Hi,
>>
>> Perhaps it's a too much simple question, but I don't know what achieve  
>> that: In nslu2 I have two network devices: eth0 and wlan0 (wifi). I just  
>> want that:
>>
>> - nslu2 tries if eth0 is plugged. If it's, then all network connection  
>> were established via eth0
>> - if eth0 is unplugged, then all network connection were established via  
>> wlan0.
>>
>> Now the first is done, but when I unplugged the eth0 I can't reach the  
>> system (all packets loose)
>>
>> Anyone could help me? I suspect that I have to touch the route table. Is  
>> it true?
>> My route table is:
>>
>> # route
>> Kernel IP routing table
>> Destination     Gateway         Genmask         Flags Metric Ref    Use  
>> Iface
>> localnet        *               255.255.0.0     U     0      0        0 eth0
>> localnet        *               255.255.0.0     U     0      0        0  
>> wlan0
>> default         172.26.0.1      0.0.0.0         UG    0      0        0  
>> wlan0
>> default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0
>>
>> wlan0 has static ip 172.26.0.3 and eth0 has static ip 172.26.0.2
>>
>> 172.26.0.1 is the router (what has internet connectivity). I just want  
>> to have local network connections between all other devices and my nslu2.
>>    
>
> Linux in general does not deal with ignoring routes just because an
> interface is down.  Unix like systems never do.  Routers do.
>  
But I can reach other boxes with the same network and different ip?
What's the easiest solution to achieve that when I unplug eth0 I can
reach nslu2 via wlan0?

Xan.


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Lennart Sorensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Oct 31, 2009 at 03:19:22PM +0100, Xan wrote:

> En/na Lennart Sorensen ha escrit:
>> On Fri, Oct 30, 2009 at 05:32:09PM +0100, Xan wrote:
>>  
>>> Hi,
>>>
>>> Perhaps it's a too much simple question, but I don't know what
>>> achieve  that: In nslu2 I have two network devices: eth0 and wlan0
>>> (wifi). I just  want that:
>>>
>>> - nslu2 tries if eth0 is plugged. If it's, then all network
>>> connection  were established via eth0
>>> - if eth0 is unplugged, then all network connection were established
>>> via  wlan0.
>>>
>>> Now the first is done, but when I unplugged the eth0 I can't reach
>>> the  system (all packets loose)
>>>
>>> Anyone could help me? I suspect that I have to touch the route table.
>>> Is  it true?
>>> My route table is:
>>>
>>> # route
>>> Kernel IP routing table
>>> Destination     Gateway         Genmask         Flags Metric Ref    
>>> Use  Iface
>>> localnet        *               255.255.0.0     U     0      0        0 eth0
>>> localnet        *               255.255.0.0     U     0      0        
>>> 0  wlan0
>>> default         172.26.0.1      0.0.0.0         UG    0      0        
>>> 0  wlan0
>>> default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0
>>>
>>> wlan0 has static ip 172.26.0.3 and eth0 has static ip 172.26.0.2
>>>
>>> 172.26.0.1 is the router (what has internet connectivity). I just
>>> want  to have local network connections between all other devices and
>>> my nslu2.
>>>    
>>
>> Linux in general does not deal with ignoring routes just because an
>> interface is down.  Unix like systems never do.  Routers do.
>>  
> But I can reach other boxes with the same network and different ip?
> What's the easiest solution to achieve that when I unplug eth0 I can  
> reach nslu2 via wlan0?

Well in your case it appears that right now eth0 is the first choice for
reaching the local network, and wlan0 is the first choice for default
route, although since the default route uses a gateway on your local
network, it may still use eth0 for that.  If eth0 goes down, you won't
be able to reach the local network, since the route in use goes to eth0
and it is down.

I use a small kernel patch that makes the kernel delete local network
routes whenever a link is down, and readd it when the link comes back.
That solves the problem.  I manage any additional static routes
(including default route) through zebra (quagga route deamon) with link
detect enabled.

The patch I use is:

diff -ruN build_i386_none_gx1.ori/Documentation/networking/ip-sysctl.txt build_i386_none_gx1/Documentation/networking/ip-sysctl.txt
--- build_i386_none_gx1.ori/Documentation/networking/ip-sysctl.txt 2009-03-30 14:34:14.000000000 -0400
+++ build_i386_none_gx1/Documentation/networking/ip-sysctl.txt 2009-03-30 14:30:35.000000000 -0400
@@ -791,7 +791,10 @@
 disable_xfrm - BOOLEAN
  Disable IPSEC encryption on this interface, whatever the policy
 
-
+link_detect - BOOLEAN
+ Causes loss of carrier remove interface addresses the same as
+ setting device down. When carrier is restored, the addresses
+ are restored.
 
 tag - INTEGER
  Allows you to write a number, which can be used as required.
diff -ruN build_i386_none_gx1.ori/include/linux/inetdevice.h build_i386_none_gx1/include/linux/inetdevice.h
--- build_i386_none_gx1.ori/include/linux/inetdevice.h 2009-03-30 14:34:14.000000000 -0400
+++ build_i386_none_gx1/include/linux/inetdevice.h 2009-03-30 14:30:35.000000000 -0400
@@ -97,6 +97,7 @@
 #define IN_DEV_PROMOTE_SECONDARIES(in_dev) \
  IN_DEV_ORCONF((in_dev), \
       PROMOTE_SECONDARIES)
+#define IN_DEV_LINK_DETECT(in_dev) IN_DEV_ORCONF((in_dev), LINK_DETECT)
 
 #define IN_DEV_RX_REDIRECTS(in_dev) \
  ((IN_DEV_FORWARD(in_dev) && \
diff -ruN build_i386_none_gx1.ori/include/linux/notifier.h build_i386_none_gx1/include/linux/notifier.h
--- build_i386_none_gx1.ori/include/linux/notifier.h 2009-03-30 14:34:14.000000000 -0400
+++ build_i386_none_gx1/include/linux/notifier.h 2009-03-30 14:30:35.000000000 -0400
@@ -197,6 +197,7 @@
 #define NETDEV_GOING_DOWN 0x0009
 #define NETDEV_CHANGENAME 0x000A
 #define NETDEV_FEAT_CHANGE 0x000B
+#define NETDEV_LINK_DOWN 0x00FF /* Used for link detect handling */
 
 #define SYS_DOWN 0x0001 /* Notify of system down */
 #define SYS_RESTART SYS_DOWN
diff -ruN build_i386_none_gx1.ori/include/linux/sysctl.h build_i386_none_gx1/include/linux/sysctl.h
--- build_i386_none_gx1.ori/include/linux/sysctl.h 2009-03-30 14:34:14.000000000 -0400
+++ build_i386_none_gx1/include/linux/sysctl.h 2009-03-30 14:30:35.000000000 -0400
@@ -490,6 +490,7 @@
  NET_IPV4_CONF_ARP_IGNORE=19,
  NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
  NET_IPV4_CONF_ARP_ACCEPT=21,
+ NET_IPV4_CONF_LINK_DETECT=22,
  __NET_IPV4_CONF_MAX
 };
 
diff -ruN build_i386_none_gx1.ori/kernel/sysctl_check.c build_i386_none_gx1/kernel/sysctl_check.c
--- build_i386_none_gx1.ori/kernel/sysctl_check.c 2009-03-30 14:34:14.000000000 -0400
+++ build_i386_none_gx1/kernel/sysctl_check.c 2009-03-30 14:30:35.000000000 -0400
@@ -219,6 +219,7 @@
  { NET_IPV4_CONF_ARP_IGNORE, "arp_ignore" },
  { NET_IPV4_CONF_PROMOTE_SECONDARIES, "promote_secondaries" },
  { NET_IPV4_CONF_ARP_ACCEPT, "arp_accept" },
+ { NET_IPV4_CONF_LINK_DETECT, "link_detect" },
  {}
 };
 
diff -ruN build_i386_none_gx1.ori/net/ipv4/devinet.c build_i386_none_gx1/net/ipv4/devinet.c
--- build_i386_none_gx1.ori/net/ipv4/devinet.c 2009-03-30 14:34:14.000000000 -0400
+++ build_i386_none_gx1/net/ipv4/devinet.c 2009-03-30 14:30:35.000000000 -0400
@@ -1434,6 +1434,7 @@
       "force_igmp_version"),
  DEVINET_SYSCTL_FLUSHING_ENTRY(PROMOTE_SECONDARIES,
       "promote_secondaries"),
+ DEVINET_SYSCTL_RW_ENTRY(LINK_DETECT, "link_detect"),
  },
 };
 
diff -ruN build_i386_none_gx1.ori/net/ipv4/fib_frontend.c build_i386_none_gx1/net/ipv4/fib_frontend.c
--- build_i386_none_gx1.ori/net/ipv4/fib_frontend.c 2009-03-30 14:34:14.000000000 -0400
+++ build_i386_none_gx1/net/ipv4/fib_frontend.c 2009-03-30 14:33:29.000000000 -0400
@@ -906,9 +906,12 @@
 static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr)
 {
  struct in_ifaddr *ifa = (struct in_ifaddr*)ptr;
+ struct net_device *dev = ifa->ifa_dev->dev;
+ struct in_device *in_dev = __in_dev_get_rtnl(dev);
 
  switch (event) {
  case NETDEV_UP:
  fib_add_ifaddr(ifa);
+ if (IN_DEV_LINK_DETECT(in_dev) && !netif_carrier_ok(dev)) fib_del_ifaddr(ifa);
 #ifdef CONFIG_IP_ROUTE_MULTIPATH
  fib_sync_up(ifa->ifa_dev->dev);
@@ -943,8 +946,14 @@
  if (!in_dev)
  return NOTIFY_DONE;
 
+ /* Link detect causes changes in carrier to add/remove addresses from FIB */
+ if (event == NETDEV_CHANGE && netif_running(dev)
+    && IN_DEV_LINK_DETECT(in_dev))
+ event = netif_carrier_ok(dev) ? NETDEV_UP : NETDEV_LINK_DOWN;
+
  switch (event) {
  case NETDEV_UP:
+ if (IN_DEV_LINK_DETECT(in_dev) && !netif_carrier_ok(dev)) break;
  for_ifa(in_dev) {
  fib_add_ifaddr(ifa);
  } endfor_ifa(in_dev);
@@ -956,6 +965,12 @@
  case NETDEV_DOWN:
  fib_disable_ip(dev, 0);
  break;
+ case NETDEV_LINK_DOWN:
+ for_ifa(in_dev) {
+ fib_del_ifaddr(ifa);
+ } endfor_ifa(in_dev);
+ rt_cache_flush(-1);
+ break;
  case NETDEV_CHANGEMTU:
  case NETDEV_CHANGE:
  rt_cache_flush(0);

Other than patching the kernel to change the behaviour to be more router
like though, about the best you can do is have a cron job or daemon
check the link state, and delete the route if the link goes down, and
add it back when the link returns.  I consider that ugly and fragile
though.

--
Len Sorensen


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Xan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

En/na Lennart Sorensen ha escrit:

> On Sat, Oct 31, 2009 at 03:19:22PM +0100, Xan wrote:
>> En/na Lennart Sorensen ha escrit:
>>> On Fri, Oct 30, 2009 at 05:32:09PM +0100, Xan wrote:
>>>  
>>>> Hi,
>>>>
>>>> Perhaps it's a too much simple question, but I don't know what
>>>> achieve  that: In nslu2 I have two network devices: eth0 and wlan0
>>>> (wifi). I just  want that:
>>>>
>>>> - nslu2 tries if eth0 is plugged. If it's, then all network
>>>> connection  were established via eth0
>>>> - if eth0 is unplugged, then all network connection were established
>>>> via  wlan0.
>>>>
>>>> Now the first is done, but when I unplugged the eth0 I can't reach
>>>> the  system (all packets loose)
>>>>
>>>> Anyone could help me? I suspect that I have to touch the route table.
>>>> Is  it true?
>>>> My route table is:
>>>>
>>>> # route
>>>> Kernel IP routing table
>>>> Destination     Gateway         Genmask         Flags Metric Ref    
>>>> Use  Iface
>>>> localnet        *               255.255.0.0     U     0      0        0 eth0
>>>> localnet        *               255.255.0.0     U     0      0        
>>>> 0  wlan0
>>>> default         172.26.0.1      0.0.0.0         UG    0      0        
>>>> 0  wlan0
>>>> default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0
>>>>
>>>> wlan0 has static ip 172.26.0.3 and eth0 has static ip 172.26.0.2
>>>>
>>>> 172.26.0.1 is the router (what has internet connectivity). I just
>>>> want  to have local network connections between all other devices and
>>>> my nslu2.
>>>>    
>>> Linux in general does not deal with ignoring routes just because an
>>> interface is down.  Unix like systems never do.  Routers do.
>>>  
>> But I can reach other boxes with the same network and different ip?
>> What's the easiest solution to achieve that when I unplug eth0 I can  
>> reach nslu2 via wlan0?
>
> Well in your case it appears that right now eth0 is the first choice for
> reaching the local network, and wlan0 is the first choice for default
> route, although since the default route uses a gateway on your local
> network, it may still use eth0 for that.  If eth0 goes down, you won't
> be able to reach the local network, since the route in use goes to eth0
> and it is down.
>
> I use a small kernel patch that makes the kernel delete local network
> routes whenever a link is down, and readd it when the link comes back.
> That solves the problem.  I manage any additional static routes
> (including default route) through zebra (quagga route deamon) with link
> detect enabled.
> [....]
First of all, I'm impressed. Wow!. Thanks for this great and comprensive
answer. Now I understand the problem I have.

Although I thank you the patch I will not patch the kernel because
patching kernels are not supported and really unmantained (the security
advisories do that I have to recompile the kernel). The ideal situation
is that your patch will be included in debian repository as whole kernel
and the more realistic situation is that it will be included only as a
patch, and with apt-get we could have it ;-)


>
>
> Other than patching the kernel to change the behaviour to be more router
> like though, about the best you can do is have a cron job or daemon
> check the link state, and delete the route if the link goes down, and
> add it back when the link returns.  I consider that ugly and fragile
> though.
>
Sorry but I have no technical skills for doing that :-(. A more simple
script were a script for switching the route table for nslu2 connects
_firstly_ via some device all the time:

for example:
# script eth0

produces a route table like:

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use
Iface
localnet        *               255.255.0.0     U     0      0        0 eth0
localnet        *               255.255.0.0     U     0      0        0
wlan0
default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0
default         172.26.0.1      0.0.0.0         UG    0      0        0
wlan0


and

# script wlan0

produces

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use
Iface
localnet        *               255.255.0.0     U     0      0        0
wlan0
localnet        *               255.255.0.0     U     0      0        0 eth0
default         172.26.0.1      0.0.0.0         UG    0      0        0
wlan0
default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0

But another way I have no tech skills for doing that. The route command
is too much complicated for me. Would you like to help me in that?

Typically, I enter via ssh in my slug in 172.26.0.2 (the eth0 static
ip), I run "script wlan0" and it swicthes to wlan0. So I unplugged the
eth0 and then I connected ssh via 172.26.0.3 (the wlan0 static ip)
(without the cable of eth0). What's the magical solution I want ;-)

Thanks a lot,
Xan.




--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Lennart Sorensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 02, 2009 at 07:01:25PM +0100, Xan wrote:
> First of all, I'm impressed. Wow!. Thanks for this great and comprensive  
> answer. Now I understand the problem I have.
>
> Although I thank you the patch I will not patch the kernel because  
> patching kernels are not supported and really unmantained (the security  
> advisories do that I have to recompile the kernel). The ideal situation  
> is that your patch will be included in debian repository as whole kernel  
> and the more realistic situation is that it will be included only as a  
> patch, and with apt-get we could have it ;-)

Unfortunately I have very little hope of that happening, simply because
that isn't how unix systems have ever behavied.  We use it in the kernels
that we ship on our products.  I could try to get it accepted upstream,
but I unfortunately don't have much hope for it.

> Sorry but I have no technical skills for doing that :-(. A more simple  
> script were a script for switching the route table for nslu2 connects  
> _firstly_ via some device all the time:
>
> for example:
> # script eth0
>
> produces a route table like:
>
> # route
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use  
> Iface
> localnet        *               255.255.0.0     U     0      0        0 eth0
> localnet        *               255.255.0.0     U     0      0        0  
> wlan0
> default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0
> default         172.26.0.1      0.0.0.0         UG    0      0        0  
> wlan0
>
>
> and
>
> # script wlan0
>
> produces
>
> # route
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use  
> Iface
> localnet        *               255.255.0.0     U     0      0        0  
> wlan0
> localnet        *               255.255.0.0     U     0      0        0 eth0
> default         172.26.0.1      0.0.0.0         UG    0      0        0  
> wlan0
> default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0

Controlling the order seems tricky.

> But another way I have no tech skills for doing that. The route command  
> is too much complicated for me. Would you like to help me in that?
>
> Typically, I enter via ssh in my slug in 172.26.0.2 (the eth0 static  
> ip), I run "script wlan0" and it swicthes to wlan0. So I unplugged the  
> eth0 and then I connected ssh via 172.26.0.3 (the wlan0 static ip)  
> (without the cable of eth0). What's the magical solution I want ;-)

Well preferably it would do it automatically of course without you
needing to do anything.

Simpler setup is to just use different IPs and subnets on eth and wlan,
although if both come from the same network that doesn't work of course.

--
Len Sorensen


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Alan Snelgrove :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 2 Nov 2009, at 19:14, Lennart Sorensen wrote:

> On Mon, Nov 02, 2009 at 07:01:25PM +0100, Xan wrote:
>> First of all, I'm impressed. Wow!. Thanks for this great and  
>> comprensive
>> answer. Now I understand the problem I have.
>>
>> Although I thank you the patch I will not patch the kernel because
>> patching kernels are not supported and really unmantained (the  
>> security
>> advisories do that I have to recompile the kernel). The ideal  
>> situation
>> is that your patch will be included in debian repository as whole  
>> kernel
>> and the more realistic situation is that it will be included only  
>> as a
>> patch, and with apt-get we could have it ;-)
>
> Unfortunately I have very little hope of that happening, simply  
> because
> that isn't how unix systems have ever behavied.  We use it in the  
> kernels
> that we ship on our products.  I could try to get it accepted  
> upstream,
> but I unfortunately don't have much hope for it.
>
>> Sorry but I have no technical skills for doing that :-(. A more  
>> simple
>> script were a script for switching the route table for nslu2 connects
>> _firstly_ via some device all the time:
>>
>> for example:
>> # script eth0
>>
>> produces a route table like:
>>
>> # route
>> Kernel IP routing table
>> Destination     Gateway         Genmask         Flags Metric Ref    
>> Use
>> Iface
>> localnet        *               255.255.0.0     U     0      
>> 0        0 eth0
>> localnet        *               255.255.0.0     U     0      
>> 0        0
>> wlan0
>> default         172.26.0.1      0.0.0.0         UG    0      
>> 0        0 eth0
>> default         172.26.0.1      0.0.0.0         UG    0      
>> 0        0
>> wlan0
>>
>>
>> and
>>
>> # script wlan0
>>
>> produces
>>
>> # route
>> Kernel IP routing table
>> Destination     Gateway         Genmask         Flags Metric Ref    
>> Use
>> Iface
>> localnet        *               255.255.0.0     U     0      
>> 0        0
>> wlan0
>> localnet        *               255.255.0.0     U     0      
>> 0        0 eth0
>> default         172.26.0.1      0.0.0.0         UG    0      
>> 0        0
>> wlan0
>> default         172.26.0.1      0.0.0.0         UG    0      
>> 0        0 eth0
>
> Controlling the order seems tricky.
>
>> But another way I have no tech skills for doing that. The route  
>> command
>> is too much complicated for me. Would you like to help me in that?
>>
>> Typically, I enter via ssh in my slug in 172.26.0.2 (the eth0 static
>> ip), I run "script wlan0" and it swicthes to wlan0. So I unplugged  
>> the
>> eth0 and then I connected ssh via 172.26.0.3 (the wlan0 static ip)
>> (without the cable of eth0). What's the magical solution I want ;-)
>
> Well preferably it would do it automatically of course without you
> needing to do anything.
>
> Simpler setup is to just use different IPs and subnets on eth and  
> wlan,
> although if both come from the same network that doesn't work of  
> course.
>
> --
> Len Sorensen
>
>
> --
> To UNSUBSCRIBE, email to debian-arm-REQUEST@...
> with a subject of "unsubscribe". Trouble? Contact listmaster@...
>

I think I have the same situation.
I can ssh using 192.168.1.6 for wlan0 interface, and 192.168.1.7 for  
the eth0 interface.
So now I have 2 sessions going through the same interface, and if I  
disconnect that interface both sessions freeze. However, if I issue  
ifdown ethO the 192.168.1.7 screen freezes but I am left with the  
wlan0 route.

 From the wlan0 session
Initial route

Destination     Gateway         Genmask         Flags Metric Ref    
Use Iface
localnet        *               255.255.255.0   U     0      0        
0 eth0
localnet        *               255.255.255.0   U     0      0        
0 wlan0
default         Fasteddy.local  0.0.0.0         UG    0      0        
0 wlan0
default         Fasteddy.local  0.0.0.0         UG    0      0        
0 eth0

ifdown eth0

Destination     Gateway         Genmask         Flags Metric Ref    
Use Iface
localnet        *               255.255.255.0   U     0      0        
0 wlan0
default         Fasteddy.local  0.0.0.0         UG    0      0        
0 wlan0

ifup eth0

Destination     Gateway         Genmask         Flags Metric Ref    
Use Iface
localnet        *               255.255.255.0   U     0      0        
0 wlan0
localnet        *               255.255.255.0   U     0      0        
0 eth0
default         Fasteddy.local  0.0.0.0         UG    0      0        
0 eth0
default         Fasteddy.local  0.0.0.0         UG    0      0        
0 wlan0

ifdown wlan0; ifup wlan0

Destination     Gateway         Genmask         Flags Metric Ref    
Use Iface
localnet        *               255.255.255.0   U     0      0        
0 eth0
localnet        *               255.255.255.0   U     0      0        
0 wlan0
default         Fasteddy.local  0.0.0.0         UG    0      0        
0 wlan0
default         Fasteddy.local  0.0.0.0         UG    0      0        
0 eth0








--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Xan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

En/na Lennart Sorensen ha escrit:

>>
>> # script wlan0
>>
>> produces
>>
>> # route
>> Kernel IP routing table
>> Destination     Gateway         Genmask         Flags Metric Ref    Use  
>> Iface
>> localnet        *               255.255.0.0     U     0      0        0  
>> wlan0
>> localnet        *               255.255.0.0     U     0      0        0 eth0
>> default         172.26.0.1      0.0.0.0         UG    0      0        0  
>> wlan0
>> default         172.26.0.1      0.0.0.0         UG    0      0        0 eth0
>>    
>
> Controlling the order seems tricky.
>  
How can I reorder them? via route command? All wlan0 //at top//

> Simpler setup is to just use different IPs and subnets on eth and wlan,
> although if both come from the same network that doesn't work of course.

Different subnets is not an option, I think. I have a router which is
the local gateway 172.26.0.1, mask 255.255.0.0. If I change mask in
172.26.0.2 (eth0) or 172.26.0.3 (wlan0), the router will be unreacheable.

How can I do that?

Thanks,
Xan.


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Xan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, I think so. If you unplugged eth0 or ifdown eth0, screen hangs.
If ifdown wlan0, nothing happens.
I think it's the problem Lennart commented out.

Lennart, could it be solved if we have this route table?


Destination     Gateway         Genmask         Flags Metric Ref    Use
Iface  localnet        *               255.255.255.0   U     0      
0        0 wlan0
localnet        *               255.255.255.0   U     0      0        0
eth0default         Fasteddy.local  0.0.0.0         UG    0      
0        0 wlan0
default         Fasteddy.local  0.0.0.0         UG    0      0        0
eth0

With that we swap the behaviour of wlan0 and eth0?

Xan.


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Lennart Sorensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 02, 2009 at 07:55:47PM +0100, old.codger@... wrote:
> I think I have the same situation.
> I can ssh using 192.168.1.6 for wlan0 interface, and 192.168.1.7 for the
> eth0 interface.
> So now I have 2 sessions going through the same interface, and if I  
> disconnect that interface both sessions freeze. However, if I issue  
> ifdown ethO the 192.168.1.7 screen freezes but I am left with the wlan0
> route.

That is pretty much expected yes.  By downing and interface, you remove
the route, so now the route on the other interface can take over.
You however also removed the IP address so you can no longer reach it.
The patch I use on the kernel removes the route but leaves the IP still
reachable.  Deleting the route, rather than shutting down the interface
makes it behave as desired.

When connecting to the two IPs with both links up, all your traffic is
going through one of the two interfaces only.

Linux (and other unices) are NOT routers.  They don't behave as one
would expect a router to behave when a link goes down.  Some of us (who
happen to be working on using linux on router products) are trying to
fix that, but so far the best I have got is the kernel patch I sent.
It works very well too.  Trying to change the behaviour of a 40 year
old OS concept isn't easy. :)

> From the wlan0 session
> Initial route
>
> Destination     Gateway         Genmask         Flags Metric Ref    Use
> Iface
> localnet        *               255.255.255.0   U     0      0        0
> eth0
> localnet        *               255.255.255.0   U     0      0        0
> wlan0
> default         Fasteddy.local  0.0.0.0         UG    0      0        0
> wlan0
> default         Fasteddy.local  0.0.0.0         UG    0      0        0
> eth0
>
> ifdown eth0
>
> Destination     Gateway         Genmask         Flags Metric Ref    Use
> Iface
> localnet        *               255.255.255.0   U     0      0        0
> wlan0
> default         Fasteddy.local  0.0.0.0         UG    0      0        0
> wlan0
>
> ifup eth0
>
> Destination     Gateway         Genmask         Flags Metric Ref    Use
> Iface
> localnet        *               255.255.255.0   U     0      0        0
> wlan0
> localnet        *               255.255.255.0   U     0      0        0
> eth0
> default         Fasteddy.local  0.0.0.0         UG    0      0        0
> eth0
> default         Fasteddy.local  0.0.0.0         UG    0      0        0
> wlan0
>
> ifdown wlan0; ifup wlan0
>
> Destination     Gateway         Genmask         Flags Metric Ref    Use
> Iface
> localnet        *               255.255.255.0   U     0      0        0
> eth0
> localnet        *               255.255.255.0   U     0      0        0
> wlan0
> default         Fasteddy.local  0.0.0.0         UG    0      0        0
> wlan0
> default         Fasteddy.local  0.0.0.0         UG    0      0        0
> eth0

--
Len Sorensen


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Lennart Sorensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 02, 2009 at 08:46:00PM +0100, Xan wrote:

> Yes, I think so. If you unplugged eth0 or ifdown eth0, screen hangs.
> If ifdown wlan0, nothing happens.
> I think it's the problem Lennart commented out.
>
> Lennart, could it be solved if we have this route table?
>
>
> Destination     Gateway         Genmask         Flags Metric Ref    Use  
> Iface  localnet        *               255.255.255.0   U     0      0    
>    0 wlan0
> localnet        *               255.255.255.0   U     0      0        0  
> eth0default         Fasteddy.local  0.0.0.0         UG    0      0        
> 0 wlan0
> default         Fasteddy.local  0.0.0.0         UG    0      0        0  
> eth0
>
> With that we swap the behaviour of wlan0 and eth0?

In that case all traffic will use the wlan interface, and if it fails,
you get nothing.

There is no way to make the linux kernel do what you want without external
help or patching.  It can't be done as far as I know.

--
Len Sorensen


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Lennart Sorensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 02, 2009 at 08:38:12PM +0100, Xan wrote:
> How can I reorder them? via route command? All wlan0 //at top//

I don't know of any way other than deleting and re-adding using the
'ip route' command (route and ifconfig are obsolete and should not be
used anymore).

> Different subnets is not an option, I think. I have a router which is  
> the local gateway 172.26.0.1, mask 255.255.0.0. If I change mask in  
> 172.26.0.2 (eth0) or 172.26.0.3 (wlan0), the router will be unreacheable.
>
> How can I do that?

You can't.

--
Len Sorensen


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Xan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

En/na Lennart Sorensen ha escrit:
> O
>
> Other than patching the kernel to change the behaviour to be more router
> like though, about the best you can do is have a cron job or daemon
> check the link state, and delete the route if the link goes down, and
> add it back when the link returns.  I consider that ugly and fragile
> though.
>
>  
How to do this script? How to test if one device is down?


Xan.


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Xan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

En/na Lennart Sorensen ha escrit:
>
>
> In that case all traffic will use the wlan interface, and if it fails,
> you get nothing.
>  

Yes, it's true. :-)
But then, could I unplugged the harddisk of nslu2 and modify the router
table? Where the router table stores? Where is the configuration file?

Xan.


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Xan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

En/na Lennart Sorensen ha escrit:

> On Mon, Nov 02, 2009 at 08:38:12PM +0100, Xan wrote:
>  
>> How can I reorder them? via route command? All wlan0 //at top//
>>    
>
> I don't know of any way other than deleting and re-adding using the
> 'ip route' command (route and ifconfig are obsolete and should not be
> used anymore).
>
>  
How can I do that? Can you  put the commands?

Thanks a lot,
Xan.


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Lennart Sorensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 02, 2009 at 09:59:03PM +0100, Xan wrote:

> En/na Lennart Sorensen ha escrit:
>> On Mon, Nov 02, 2009 at 08:38:12PM +0100, Xan wrote:
>>  
>>> How can I reorder them? via route command? All wlan0 //at top//
>>>    
>>
>> I don't know of any way other than deleting and re-adding using the
>> 'ip route' command (route and ifconfig are obsolete and should not be
>> used anymore).
>>
>>  
> How can I do that? Can you  put the commands?

If you have:

ip route:
10.200.64.0/20 dev eth0  proto kernel  scope link  src 10.200.65.12
10.200.64.0/20 dev wlan0  proto kernel  scope link  src 10.200.65.12
default via 10.200.16.1 dev eth0
default via 10.200.16.1 dev wlan0

You could do:
ip route del default via 10.200.16.1 dev eth0
ip route del 10.200.64.0/20 dev eth0  proto kernel  scope link  src 10.200.65.12

If the link comes back on eth0, you could then do
ip route add 10.200.64.0/20 dev eth0  proto kernel  scope link  src 10.200.65.12
ip route add default via 10.200.16.1 dev eth0

Similar for the wlan0 one.

The ip command is extremely useful and much more powerful than route and
ifconfig ever were.  A lot more options are available, and the syntax
is a lot nicer too.

--
Len Sorensen


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Lennart Sorensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 02, 2009 at 09:58:22PM +0100, Xan wrote:
> Yes, it's true. :-)
> But then, could I unplugged the harddisk of nslu2 and modify the router  
> table? Where the router table stores? Where is the configuration file?

It is not stored.  It is generated based on the interface configuration.

--
Len Sorensen


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Lennart Sorensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 02, 2009 at 09:56:10PM +0100, Xan wrote:

> En/na Lennart Sorensen ha escrit:
>> O
>>
>> Other than patching the kernel to change the behaviour to be more router
>> like though, about the best you can do is have a cron job or daemon
>> check the link state, and delete the route if the link goes down, and
>> add it back when the link returns.  I consider that ugly and fragile
>> though.
>>  
> How to do this script? How to test if one device is down?

'ethtool' or 'ip link' should be able to tell you if a link is up or down.
A clever tool would subscribe to netlink and get notifications of link
state changes, but that probably isn't necesary.

--
Len Sorensen


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: nslu2: two devices: one by default

by Xan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

En/na Lennart Sorensen ha escrit:

> On Mon, Nov 02, 2009 at 09:58:22PM +0100, Xan wrote:
>  
>> Yes, it's true. :-)
>> But then, could I unplugged the harddisk of nslu2 and modify the router  
>> table? Where the router table stores? Where is the configuration file?
>>    
>
> It is not stored.  It is generated based on the interface configuration.
>
>  
So, when we use ip or route, where the data stores? If we reboot, the
same behaviour is wished.

Xan.


--
To UNSUBSCRIBE, email to debian-arm-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...

< Prev | 1 - 2 | Next >