1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun========== 4*4882a593Smuzhiyunbatman-adv 5*4882a593Smuzhiyun========== 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunBatman advanced is a new approach to wireless networking which does no longer 8*4882a593Smuzhiyunoperate on the IP basis. Unlike the batman daemon, which exchanges information 9*4882a593Smuzhiyunusing UDP packets and sets routing tables, batman-advanced operates on ISO/OSI 10*4882a593SmuzhiyunLayer 2 only and uses and routes (or better: bridges) Ethernet Frames. It 11*4882a593Smuzhiyunemulates a virtual network switch of all nodes participating. Therefore all 12*4882a593Smuzhiyunnodes appear to be link local, thus all higher operating protocols won't be 13*4882a593Smuzhiyunaffected by any changes within the network. You can run almost any protocol 14*4882a593Smuzhiyunabove batman advanced, prominent examples are: IPv4, IPv6, DHCP, IPX. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunBatman advanced was implemented as a Linux kernel driver to reduce the overhead 17*4882a593Smuzhiyunto a minimum. It does not depend on any (other) network driver, and can be used 18*4882a593Smuzhiyunon wifi as well as ethernet lan, vpn, etc ... (anything with ethernet-style 19*4882a593Smuzhiyunlayer 2). 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunConfiguration 23*4882a593Smuzhiyun============= 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunLoad the batman-adv module into your kernel:: 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun $ insmod batman-adv.ko 28*4882a593Smuzhiyun 29*4882a593SmuzhiyunThe module is now waiting for activation. You must add some interfaces on which 30*4882a593Smuzhiyunbatman-adv can operate. The batman-adv soft-interface can be created using the 31*4882a593Smuzhiyuniproute2 tool ``ip``:: 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun $ ip link add name bat0 type batadv 34*4882a593Smuzhiyun 35*4882a593SmuzhiyunTo activate a given interface simply attach it to the ``bat0`` interface:: 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun $ ip link set dev eth0 master bat0 38*4882a593Smuzhiyun 39*4882a593SmuzhiyunRepeat this step for all interfaces you wish to add. Now batman-adv starts 40*4882a593Smuzhiyunusing/broadcasting on this/these interface(s). 41*4882a593Smuzhiyun 42*4882a593SmuzhiyunTo deactivate an interface you have to detach it from the "bat0" interface:: 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun $ ip link set dev eth0 nomaster 45*4882a593Smuzhiyun 46*4882a593SmuzhiyunThe same can also be done using the batctl interface subcommand:: 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun batctl -m bat0 interface create 49*4882a593Smuzhiyun batctl -m bat0 interface add -M eth0 50*4882a593Smuzhiyun 51*4882a593SmuzhiyunTo detach eth0 and destroy bat0:: 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun batctl -m bat0 interface del -M eth0 54*4882a593Smuzhiyun batctl -m bat0 interface destroy 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunThere are additional settings for each batadv mesh interface, vlan and hardif 57*4882a593Smuzhiyunwhich can be modified using batctl. Detailed information about this can be found 58*4882a593Smuzhiyunin its manual. 59*4882a593Smuzhiyun 60*4882a593SmuzhiyunFor instance, you can check the current originator interval (value 61*4882a593Smuzhiyunin milliseconds which determines how often batman-adv sends its broadcast 62*4882a593Smuzhiyunpackets):: 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun $ batctl -M bat0 orig_interval 65*4882a593Smuzhiyun 1000 66*4882a593Smuzhiyun 67*4882a593Smuzhiyunand also change its value:: 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun $ batctl -M bat0 orig_interval 3000 70*4882a593Smuzhiyun 71*4882a593SmuzhiyunIn very mobile scenarios, you might want to adjust the originator interval to a 72*4882a593Smuzhiyunlower value. This will make the mesh more responsive to topology changes, but 73*4882a593Smuzhiyunwill also increase the overhead. 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunInformation about the current state can be accessed via the batadv generic 76*4882a593Smuzhiyunnetlink family. batctl provides a human readable version via its debug tables 77*4882a593Smuzhiyunsubcommands. 78*4882a593Smuzhiyun 79*4882a593Smuzhiyun 80*4882a593SmuzhiyunUsage 81*4882a593Smuzhiyun===== 82*4882a593Smuzhiyun 83*4882a593SmuzhiyunTo make use of your newly created mesh, batman advanced provides a new 84*4882a593Smuzhiyuninterface "bat0" which you should use from this point on. All interfaces added 85*4882a593Smuzhiyunto batman advanced are not relevant any longer because batman handles them for 86*4882a593Smuzhiyunyou. Basically, one "hands over" the data by using the batman interface and 87*4882a593Smuzhiyunbatman will make sure it reaches its destination. 88*4882a593Smuzhiyun 89*4882a593SmuzhiyunThe "bat0" interface can be used like any other regular interface. It needs an 90*4882a593SmuzhiyunIP address which can be either statically configured or dynamically (by using 91*4882a593SmuzhiyunDHCP or similar services):: 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun NodeA: ip link set up dev bat0 94*4882a593Smuzhiyun NodeA: ip addr add 192.168.0.1/24 dev bat0 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun NodeB: ip link set up dev bat0 97*4882a593Smuzhiyun NodeB: ip addr add 192.168.0.2/24 dev bat0 98*4882a593Smuzhiyun NodeB: ping 192.168.0.1 99*4882a593Smuzhiyun 100*4882a593SmuzhiyunNote: In order to avoid problems remove all IP addresses previously assigned to 101*4882a593Smuzhiyuninterfaces now used by batman advanced, e.g.:: 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun $ ip addr flush dev eth0 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun 106*4882a593SmuzhiyunLogging/Debugging 107*4882a593Smuzhiyun================= 108*4882a593Smuzhiyun 109*4882a593SmuzhiyunAll error messages, warnings and information messages are sent to the kernel 110*4882a593Smuzhiyunlog. Depending on your operating system distribution this can be read in one of 111*4882a593Smuzhiyuna number of ways. Try using the commands: ``dmesg``, ``logread``, or looking in 112*4882a593Smuzhiyunthe files ``/var/log/kern.log`` or ``/var/log/syslog``. All batman-adv messages 113*4882a593Smuzhiyunare prefixed with "batman-adv:" So to see just these messages try:: 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun $ dmesg | grep batman-adv 116*4882a593Smuzhiyun 117*4882a593SmuzhiyunWhen investigating problems with your mesh network, it is sometimes necessary to 118*4882a593Smuzhiyunsee more detailed debug messages. This must be enabled when compiling the 119*4882a593Smuzhiyunbatman-adv module. When building batman-adv as part of the kernel, use "make 120*4882a593Smuzhiyunmenuconfig" and enable the option ``B.A.T.M.A.N. debugging`` 121*4882a593Smuzhiyun(``CONFIG_BATMAN_ADV_DEBUG=y``). 122*4882a593Smuzhiyun 123*4882a593SmuzhiyunThose additional debug messages can be accessed using the perf infrastructure:: 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun $ trace-cmd stream -e batadv:batadv_dbg 126*4882a593Smuzhiyun 127*4882a593SmuzhiyunThe additional debug output is by default disabled. It can be enabled during 128*4882a593Smuzhiyunrun time:: 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun $ batctl -m bat0 loglevel routes tt 131*4882a593Smuzhiyun 132*4882a593Smuzhiyunwill enable debug messages for when routes and translation table entries change. 133*4882a593Smuzhiyun 134*4882a593SmuzhiyunCounters for different types of packets entering and leaving the batman-adv 135*4882a593Smuzhiyunmodule are available through ethtool:: 136*4882a593Smuzhiyun 137*4882a593Smuzhiyun $ ethtool --statistics bat0 138*4882a593Smuzhiyun 139*4882a593Smuzhiyun 140*4882a593Smuzhiyunbatctl 141*4882a593Smuzhiyun====== 142*4882a593Smuzhiyun 143*4882a593SmuzhiyunAs batman advanced operates on layer 2, all hosts participating in the virtual 144*4882a593Smuzhiyunswitch are completely transparent for all protocols above layer 2. Therefore 145*4882a593Smuzhiyunthe common diagnosis tools do not work as expected. To overcome these problems, 146*4882a593Smuzhiyunbatctl was created. At the moment the batctl contains ping, traceroute, tcpdump 147*4882a593Smuzhiyunand interfaces to the kernel module settings. 148*4882a593Smuzhiyun 149*4882a593SmuzhiyunFor more information, please see the manpage (``man batctl``). 150*4882a593Smuzhiyun 151*4882a593Smuzhiyunbatctl is available on https://www.open-mesh.org/ 152*4882a593Smuzhiyun 153*4882a593Smuzhiyun 154*4882a593SmuzhiyunContact 155*4882a593Smuzhiyun======= 156*4882a593Smuzhiyun 157*4882a593SmuzhiyunPlease send us comments, experiences, questions, anything :) 158*4882a593Smuzhiyun 159*4882a593SmuzhiyunIRC: 160*4882a593Smuzhiyun #batman on irc.freenode.org 161*4882a593SmuzhiyunMailing-list: 162*4882a593Smuzhiyun b.a.t.m.a.n@open-mesh.org (optional subscription at 163*4882a593Smuzhiyun https://lists.open-mesh.org/mailman3/postorius/lists/b.a.t.m.a.n.lists.open-mesh.org/) 164*4882a593Smuzhiyun 165*4882a593SmuzhiyunYou can also contact the Authors: 166*4882a593Smuzhiyun 167*4882a593Smuzhiyun* Marek Lindner <mareklindner@neomailbox.ch> 168*4882a593Smuzhiyun* Simon Wunderlich <sw@simonwunderlich.de> 169