serf: Serf unable to bind to network subinterface

Trying to setup mesh network using B.A.T.M.A.N with Avahi; and run serf on top of the mesh network.

$ ifconfig
bat0      Link encap:Ethernet  HWaddr fa:f3:e1:24:5b:40
          inet6 addr: fe80::f8f3:e1ff:fe24:5b40/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:47703 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46338 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3891442 (3.7 MiB)  TX bytes:3769271 (3.5 MiB)

bat0:avahi Link encap:Ethernet  HWaddr fa:f3:e1:24:5b:40
          inet addr:169.254.6.206  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0      Link encap:Ethernet  HWaddr 6c:ec:eb:ad:70:4a
          inet addr:192.168.3.115  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::6eec:ebff:fead:704a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3712330 errors:0 dropped:0 overruns:0 frame:0
          TX packets:139834 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:357287184 (340.7 MiB)  TX bytes:10875553 (10.3 MiB)
          Interrupt:40

By default, serf will try to bind to eth0/192.168.x.x address. So following the instructions under “Configuration”, I tried to use add the -iface option, but this results in an error:

$ ./serf agent -iface=bat0:avahi -discover=my-cluster
==> Invalid network interface: no such network interface

Not sure if this is a problem in serf or Go network library? Is this a valid use case for -iface?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Sure - this should do it:

package main

import (
        "fmt"
        "net"
)

func main() {
        ifcs, err := net.Interfaces()
        if err != nil {
                panic(err)
        }

        for _, ifc := range ifcs {
                fmt.Println(ifc.Name)
        }
}

You can save that as interface.go and then run go build interface.go, which should dump out the executable in the same directory.