running checks on a specific network interface
Tavis Paquette
tavis.lists at galaxytelecom.net
Thu Aug 26 21:04:01 CEST 2004
There is a way you can accomplish what i think your trying to accomplish
using iproute2, although there is a catch
You can route all local traffic out any interface (virtual or otherwise)
you want with a routing rule and a secondary routing table
The catch is that if the interface goes down (layer two, or
administratively) than the secondary routing table is lost (although
there is a set of patches you can install that will mitigate this
problem, see "http://www.ssi.bg/~ja/" and the dead gateway
detection/static routes patches)
---
#!/bin/bash
NETWORK=192.168.100.0
VINT_IP=192.168.100.80
ETH2_GW=192.168.100.254
ip rule pref 10000 dev lo table 400
ip route add $NETWORK src $VINT_IP dev eth2 table 400
ip route add default via $ETH#_GW dev eth2 table 400
----
Where:
$NETWORK = The network address of the ip range, ie the network address
of 192.168.100.0/23 is "192.168.100.0"
$VINT_IP = The ip address of the virtual interface
eth# = the interface, not the virtual interface
$ETH#_GW = the router for the virtual interfaces address range
this will route all locally generated traffic out the virtual interface
(or at least using the virtual ip)
note: the system will still respond to requests using the default route
if you have one installed, but there is other fun stuff you can do with
responses to requests as well
its highely recommended you read the Linux Advanced Routing howto. At
time ip routing with linux can become pretty arcane: http://lartc.org/
Marc Powell wrote:
>
>
>>-----Original Message-----
>>From: Albert Spruyt [mailto:appie at procolix.com]
>>Sent: Thursday, August 26, 2004 3:17 AM
>>To: nagios-devel at lists.sourceforge.net
>>Subject: [Nagios-devel] running checks on a specific network interface
>>
>>we are currently changing nagios servers (machine and nagios version).
>>The new machine has 2 network interfaces as well as 3 virtual ones.
>>Is there an easy ( or a not so easy one) way to get the traffic from
>>
>>
>the
>
>
>>nagios checks onto a specific network interface?(like the apache
>>listen:*.*.*.*:** directive) If no-one seems interested please point
>>
>>
>me
>
>
>>in the right direction. could it be done with a wrapper script?
>>or would it mean changing all the checks? or has it already been
>>implemented?
>>it would allow me in the future to change nagios to a diffrent server
>>whithout much hassle.
>>( we like our servers that way ;) )
>>
>>
>
>
>This is standard routing, controlled by your OS. All checks will go out
>the interface specified as your default route unless you have more
>specific routes set up. All programs have very little control over how
>their outbound traffic is routed. If they did, they would have to be
>aware of the state of the network to avoid routing deficiencies...
>
>--
>Marc
>
>
>
>
>
>-------------------------------------------------------
>SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
>100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
>Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
>http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
>_______________________________________________
>Nagios-devel mailing list
>Nagios-devel at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/nagios-devel
>
>
>
>
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
More information about the Developers
mailing list