frankjoke / ioBroker.radar

ioBroker der Verfügbarkeiten von IP- und Bluetooth-Adressen prüft
MIT License
5 stars 5 forks source link

Make interface configurable for arp-scan #26

Closed cernst1980 closed 5 years ago

cernst1980 commented 6 years ago

In the log, I see MAC addresses 'xx:xx:xx:xx:xx:xx' will not be scanned because no arp-scan is available! although arp-scan is installed and in path.

When I execute "arp-scan -lgq --retry=7", I get the following error.

WARNING: Could not obtain IP address for interface igb0. Using 0.0.0.0 for
the source address, which is probably not what you want.
Either configure igb0 with an IP address, or manually specify the address
with the --arpspa option.
Interface: igb0, datalink type: EN10MB (Ethernet)
ERROR: Could not obtain interface IP address and netmask
ERROR: pcap_lookupnet: igb0: no IPv4 address assigned

This is, because I use lagg on FreeBSD. https://www.freebsd.org/doc/handbook/network-aggregation.html

ifconfig -a
igb0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 9000
        options=6403bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
        ether d0:50:99:xx:xx:5c
        hwaddr d0:50:99:xx:xx:5c
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
igb1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 9000
        options=6403bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
        ether d0:50:99:xx:xx:5c
        hwaddr d0:50:99:xx:xx:5d
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet 127.0.0.93 netmask 0xff000000 
        groups: lo 
lagg0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 9000
        options=6403bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6>
        ether d0:50:99:xx:xx:5c
        inet 192.168.xx.93 netmask 0xffffff00 broadcast 192.168.xx.255 
        media: Ethernet autoselect
        status: active
        groups: lagg 
        laggproto failover lagghash l2,l3,l4
        laggport: igb0 flags=5<MASTER,ACTIVE>
        laggport: igb1 flags=0<>

So interface lagg0 needs to be used by arp-scan.

When executing "arp-scan -lgq --retry=7 -I lagg0", it is working.

Interface: lagg0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.9 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
...

4880 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9: 256 hosts scanned in 16.637 seconds (15.39 hosts/sec). 23 responded

So the interface needs to be configurable or auto detected.

frankjoke commented 6 years ago

I am not a network specialist but it seems to be same problem as some people before. The network you are using is not the first in ifconfig. You can try to change network settings so that the network on which your devices are is the first or you change the calls (as somebody stated earlier) for arp-scan to include the all network option (test it on command line first). I am currently still OOH and cannot test/check anything.

cernst1980 commented 6 years ago

Unfortunately, I cannot change the order in ifconfig, because lagg0 is a different type of interface than igb0.

As a workaround, I have already changed the arp-scan options. https://github.com/cernst1980/ioBroker.radar/commit/a5a319798d4a3c83fb2acf2e22b5d5a5d03533b5

But better solution would be interface selection similar to admin adapter. https://github.com/ioBroker/ioBroker.admin/blob/e136f5892b5ea85193ae2c858fd484c3ded0f33e/src/js/adapter-settings.js#L979 ff.

bildschirmfoto 2018-11-01 um 22 31 59
frankjoke commented 5 years ago

Just put v1.2 on git where you should be able to configure parameters for arp-scan!