Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending data to influxDB through specific interface/bind IP address #4287

Closed
elieyal opened this issue Jun 14, 2018 · 12 comments · Fixed by #15225 or #15228
Closed

Sending data to influxDB through specific interface/bind IP address #4287

elieyal opened this issue Jun 14, 2018 · 12 comments · Fixed by #15225 or #15228
Labels
discussion Topics for discussion

Comments

@elieyal
Copy link

elieyal commented Jun 14, 2018

Hi,
I haven't seen any option to bind an IP address for sending information out from Telegraf.
I would expect to find an option to do a bind-address when configuring the outputs.
please tell me if this is possible today or is this not a valid option today?

the use case is that I have a server with multiple interfaces and the management interface (with the default GW) is not connected to the Internet and will not allow connection to the influxdb servers.
In this case I need to make Telegraf know to send the traffic through a different interface.
is it possible?

@danielnelson
Copy link
Contributor

I believe this should be handled by proper configuration of your routing table. For instance on my system:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.79.40.1      0.0.0.0         UG    6      0        0 bond0
10.79.40.0      0.0.0.0         255.255.255.0   U     6      0        0 bond0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

Data to the 192.168.122/24 networks goes to virbr0 while everything else goes out to bond0.

@danielnelson danielnelson added the discussion Topics for discussion label Jun 14, 2018
@poodad
Copy link

poodad commented Aug 30, 2019

I'd like to re-open this as an issue. I'm trying to run telegraf on an OPNSense firewall. The influx server is on the other side of an ipsec tunnel. Since OPNSense ipsec is policy based (no tunnel interface to route to), I can't use telegraf because it binds to OPNsense's public IP, not the LAN IP which is not in the ipsec policy interesting traffic.

@glinton
Copy link
Contributor

glinton commented Sep 3, 2019

If a plugin listens on a socket, it is generally configurable. Check the readme for the plugin you are using and open a new issue if you are unable to listen on your desired interface.

@danielnelson
Copy link
Contributor

Since OPNSense ipsec is policy based (no tunnel interface to route to), I can't use telegraf because it binds to OPNsense's public IP, not the LAN IP which is not in the ipsec policy interesting traffic.

I've never used a tunnel like this myself, how do the policies work? There must be some way to control what goes into the tunnel, since hardly any programs allow you to select the interface.

@poodad
Copy link

poodad commented Sep 3, 2019 via email

@danielnelson
Copy link
Contributor

Can't you just express something like: "all traffic with dest port 8086 is interesting"?

@poodad
Copy link

poodad commented Sep 4, 2019 via email

@danielnelson
Copy link
Contributor

That makes sense, similar in that respect to a routing table, but I'm still a bit confused on the network topology.

Let's say you have host "telegraf" talking to host "influxdb". Let's say that telegraf has a public address 93.184.216.34 and the LAN address 192.168.0.1. Both of these are on the same interface and the routing table just has one entry?

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    6      0        0 eth0
192.168.0.1     0.0.0.0         255.255.255.0   U     6      0        0 eth0

InfluxDB has the LAN address 192.168.0.2. So long as you list 192.168.0/24 as interesting traffic it seems like all should work. What am I missing?

@poodad
Copy link

poodad commented Sep 5, 2019 via email

@danielnelson
Copy link
Contributor

What does the routing table look like?

With 192.168.2.1 -> 192.168.2.100, you may need to add a route like:

ip route add 192.168.2.0/24 dev eth0 src 191.168.2.1

What does this say?

ip route get 192.168.2.100

@topranks
Copy link

topranks commented Oct 8, 2020

We need to source our traffic from a loopback IP.

There are many and varied kinds of systems out there. It is extremely common for all kinds of services to allow for a "bind" option to determine which IP they attach to when starting.

InfluxDB has just such an option. It wouldd be great if this were possible with telegraf too.

@iceman91176
Copy link

+1 - also have the need for binding it to a loopback-ip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Topics for discussion
Projects
None yet
6 participants