Hello, eveyone, I am learning the batman.adv recently.
We know that batman.adv works on layer 2. When the network topology change, batman.adv can know this change and handle it. But the IP layer doesn't know that. How to make IP layer handle the change of network topology?
For example, I have 3 mesh nodes, client node A, gateway node B and geteway node C. A connects to internet via B. Then I shutdown B. I guess A will switch to C as it's gateway node automatically. But it's not so. A continuously send the ARP request packet to search the MAC address of B. The default gateway is still B, not C.
So, how should I do to make the IP layer be aware of that the gateway has swithed to another one?
Thanks! Best regards.
liu
Hi Lui,
there is no direct way to get a topology change in userspace unless you want to parse the originator table (and even in that case you will only see "local" changes).
The behaviour you described about the ARP packets is normal because the IP layer does not know anything about changes happening at the batman-adv layer. You need to handle them by yourself (if possible).
However it looks like you want to detect a "gateway change" rather than a real "topology change".
Please check this link[1] out that is explaining how batman-adv tells userspace about GW changes.
Cheers,
[1] http://www.open-mesh.org/projects/batman-adv/wiki/Uevent#Gateway-uevents
On 07/08/14 09:49, liudows wrote:
Hello, eveyone, I am learning the batman.adv recently.
We know that batman.adv works on layer 2. When the network topology change, batman.adv can know this change and handle it. But the IP layer doesn't know that. How to make IP layer handle the change of network topology?
For example, I have 3 mesh nodes, client node A, gateway node B and geteway node C. A connects to internet via B. Then I shutdown B. I guess A will switch to C as it's gateway node automatically. But it's not so. A continuously send the ARP request packet to search the MAC address of B. The default gateway is still B, not C.
So, how should I do to make the IP layer be aware of that the gateway has swithed to another one?
Thanks! Best regards.
liu
Hi liu,
Hello, eveyone, I am learning the batman.adv recently.
We know that batman.adv works on layer 2. When the network topology change, batman.adv can know this change and handle it. But the IP layer doesn't know that. How to make IP layer handle the change of network topology?
The IP layer does not need to know - to the upper layers, a batman-adv network appears to be a network where all nodes are just one hop away - although they might be more far away in practice. So if you insert an IP packet, it will get transported automatically to the right destination (provided batman-adv knows where that is), even over multiple hops.
For example, I have 3 mesh nodes, client node A, gateway node B and geteway node C. A connects to internet via B. Then I shutdown B. I guess A will switch to C as it's gateway node automatically. But it's not so. A continuously send the ARP request packet to search the MAC address of B. The default gateway is still B, not C.
This will only work if the gateways IP stays the same. This could work like that: * connect B and C to the same LAN, and enable bridge loop avoidance in batman-adv * This LAN should have only one router to the internet (e.g. your ADSL modem). * bridge the batman-interface bat0 and you Ethernet interface eth0 using a linux bridge device
So, how should I do to make the IP layer be aware of that the gateway has swithed to another one?
Thanks! Best regards.
liu
--- Mit freundlichen Grüßen / kind regards Simon Wunderlich
Fon: +49 (0) 3741 / 2518068-0 Fax: +49 (0) 3741 / 2518068-9
Bah, i hit the wrong button before finishing the mail :)
Hi liu,
Hello, eveyone, I am learning the batman.adv recently.
We know that batman.adv works on layer 2. When the network topology change, batman.adv can know this change and handle it. But the IP layer doesn't know that. How to make IP layer handle the change of network topology?
The IP layer does not need to know - to the upper layers, a batman-adv network appears to be a network where all nodes are just one hop away - although they might be more far away in practice. So if you insert an IP packet, it will get transported automatically to the right destination (provided batman-adv knows where that is), even over multiple hops.
For example, I have 3 mesh nodes, client node A, gateway node B and geteway node C. A connects to internet via B. Then I shutdown B. I guess A will switch to C as it's gateway node automatically. But it's not so. A continuously send the ARP request packet to search the MAC address of B. The default gateway is still B, not C.
This will only work if the gateways IP stays the same. This could work like that:
- connect B and C to the same LAN, and enable bridge loop avoidance in
batman-adv
- This LAN should have only one router to the internet (e.g. your ADSL
modem).
- bridge the batman-interface bat0 and you Ethernet interface eth0 using a
linux bridge device
Please see our quick start guide for more information on the topic:
http://www.open-mesh.org/projects/batman-adv/wiki/Quick-start-guide#Mixing- non-BATMAN-systems-with-batman-adv
So, how should I do to make the IP layer be aware of that the gateway has swithed to another one?
By using bridges, you always send to the same gateway in your LAN, which does not change IP or MAC addresses - so your clients don't need to be aware of the topology change.
Cheers, Simon
Thanks for reply. I have tried to fix this problem followed by Simon's guide. Unfortunately It stil doesn't work.I draw a pciture named 'topo.jpg' in the attachment to describe my situation.
Gateway B and C are wired to router 192.168.1.1 through their 'WAN' interface. They are in the same LAN. 'bat0' and 'eth0' are bridged by 'br-lan' interface, and are assigned a mesh subnet IP address '10.130.1.x'.
Client A connected to B and C by mesh network. 'bat0' and 'wan' is bridged by 'br-wan' in Client A. 'br-wan' is assigned a subnet IP address by DHCP server in B or C, for example '10.130.1.138'.
Now, client A choose B as it's gateway, and it's routing table is : root@dragino2-71e100:~# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 10.130.1.20 0.0.0.0 UG 0 0 0 br-wan 10.10.1.0 * 255.255.255.0 U 0 0 0 wlan0-1 10.130.1.0 * 255.255.255.0 U 0 0 0 br-lan 10.130.1.0 * 255.255.255.0 U 0 0 0 br-wan
Now, I can ping to the router ' 192.168.1.1' from A.
Then, shuting down the node B. In the routing table of A, node B is still the default gateway. A can't ping to '192.168.1.1' now.
The key of this issue is client A and the internet router are not in the same network segment. So, the default gateway of A is B or C, but not the router. If B is lost, A can't change it's default gateway to C. In another words, it's not a self-healing network in this situation.
Best regards, liu
在 2014/8/7 16:32, Simon Wunderlich 写道:
Bah, i hit the wrong button before finishing the mail :)
Hi liu,
Hello, eveyone, I am learning the batman.adv recently.
We know that batman.adv works on layer 2. When the network topology change, batman.adv can know this change and handle it. But the IP layer doesn't know that. How to make IP layer handle the change of network topology?
The IP layer does not need to know - to the upper layers, a batman-adv network appears to be a network where all nodes are just one hop away - although they might be more far away in practice. So if you insert an IP packet, it will get transported automatically to the right destination (provided batman-adv knows where that is), even over multiple hops.
For example, I have 3 mesh nodes, client node A, gateway node B and geteway node C. A connects to internet via B. Then I shutdown B. I guess A will switch to C as it's gateway node automatically. But it's not so. A continuously send the ARP request packet to search the MAC address of B. The default gateway is still B, not C.
This will only work if the gateways IP stays the same. This could work like that:
- connect B and C to the same LAN, and enable bridge loop avoidance in
batman-adv
- This LAN should have only one router to the internet (e.g. your ADSL
modem).
- bridge the batman-interface bat0 and you Ethernet interface eth0 using a
linux bridge device
Please see our quick start guide for more information on the topic:
http://www.open-mesh.org/projects/batman-adv/wiki/Quick-start-guide#Mixing- non-BATMAN-systems-with-batman-adv
So, how should I do to make the IP layer be aware of that the gateway has swithed to another one?
By using bridges, you always send to the same gateway in your LAN, which does not change IP or MAC addresses - so your clients don't need to be aware of the topology change.
Cheers, Simon
Hello Liu,
Thanks for reply. I have tried to fix this problem followed by Simon's guide. Unfortunately It stil doesn't work.I draw a pciture named 'topo.jpg' in the attachment to describe my situation.
Gateway B and C are wired to router 192.168.1.1 through their 'WAN' interface. They are in the same LAN. 'bat0' and 'eth0' are bridged by 'br-lan' interface, and are assigned a mesh subnet IP address '10.130.1.x'.
Client A connected to B and C by mesh network. 'bat0' and 'wan' is bridged by 'br-wan' in Client A. 'br-wan' is assigned a subnet IP address by DHCP server in B or C, for example '10.130.1.138'.
You are still doing routing in that scenario. Instead, you should bridge all nodes in the same network, and they should be in the same IP subnet. If you configure another WAN, you are back to routing, which will not work for that scenario.
Please configure eth0, wan and bat0 in the same bridge (e.g. br-lan) on all devices. Don't configure other bridges. Then, your devices and your client should get an IP address from the 192.168.1.x subnet, and should be able to ping 192.168.1.1, even if node A fails.
Cheers, Simon
b.a.t.m.a.n@lists.open-mesh.org