Mailinglist Archive: opensuse (1420 mails)

< Previous Next >
Re: [opensuse] Is it possible to run a script automatically when network manager gets a connection?
  • From: "Carlos E. R." <robin.listas@xxxxxxxxxxxxxx>
  • Date: Sun, 12 Jan 2014 03:29:00 +0100 (CET)
  • Message-id: <alpine.LNX.2.00.1401120317120.21163@Telcontar.valinor>
Hash: SHA1

On Saturday, 2014-01-11 at 19:50 -0300, Cristian Rodríguez wrote:
El 11/01/14 16:02, Carlos E. R. escribió:

Well, that's it, I would like to run a script of my own at that point.
Is it possible?

what *exactly* are you trying to accomplish ?

"when network manager gets a connection" is ambiguous at best, misleading at worst.

Cosas :-)

Ok, I'll explain my little idea.

I'm using on my laptop, since recently, dnsmasq. The configuration is the following:

- In network manager, I say that I want to use DNS server at

- In /etc/dnsmasq.conf I have:


I can not set a configuration different for each network site I'm at, for dnsmasq, it is a static config. However, on some sites, I might want to use the available router (the IP can be different each time), at others something different, like the dns recommended by dhcp... so my little idea was to automatically edit "/etc/dnsmasq.conf" on connection up to add the appropriate dns server. Maybe taken from a list of configs.

For this I need to on the script to obtain data about the connection: the /etc/ppp/ip-up script got several interesting parameters on the command line. I don't know if those on "/etc/NetworkManager/dispatcher.d/" can get the same data set.

Another thing I may want (I haven't thought this one out yet) is when using dhcp have the setting written to dnsmasq, and reset th resolv file to the 127. address.

- -- Cheers,
Carlos E. R.
(from 12.3 x86_64 "Dartmouth" at Telcontar)
Version: GnuPG v2.0.19 (GNU/Linux)

< Previous Next >