[clug] conditional syslogging

David Deaves david.deaves at dd.id.au
Tue Nov 13 23:44:04 UTC 2018

To achieve this sort of thing, I normally just configure the desired service though
the normal config files.  Then add a black hole route for a bigger netmask (thus lower
priority). I have mostly done this to support a  proxy.pac  file that has a list of
proxies in order depending on what network I am on, finishing with DIRECT.

route add -net reject
ip route add unreachable

I put these in /etc/rc.local

So when I am on the correct network the specific route will exist allowing connections.
When somewhere else the packets won't leave my laptop, and will get an ICMP net-unreachable

This does mean when on a network that has multiple networks that fall under the bigger
net I need to add those extra routes, and not rely on the default route.  I have handled
this by putting my own script in  /etc/NetworkManager/dispatcher.d/  it also does useful
things like change my default printer....

If you wanted to do it via dhcp,
You could also do it in a script in  /etc/dhcp/dhclient.d/, but you will need to change
/var/lib/NetworkManager/dhclient-wlp2s0.conf (or equivalent) to ask for the parameter.

> I want to be able to get a laptop to log to a syslog server if it is on a particular network.  Is there any simple way to do this?  I could add s syslog option to DHCP but does anything honour this option?
> Kim
> --
> Kim Holburn
> IT Network & Security Consultant
> T: +61 2 61402408  M: +61 404072753
> mailto:kim at holburn.net  aim://kimholburn
> skype://kholburn - PGP Public Key on request
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux

More information about the linux mailing list