On 02/07/2012 08:30, Helmut Hullen wrote:
Hallo, Vincent,

Du meintest am 02.07.12:

But it seems to be a bit more difficult to change
automatically something like

     dhcp-range=eth0,192.168.0.10,static
     dhcp-range=eth1,192.168.1,10,static
     dhcp-range=eth2,192.168.17.10-192.168,28.250

to

     dhcp-range=eth0,192.168.0.10,static
     dhcp-range=eth2,192.168.1,10,static
     dhcp-range=eth1,192.168.17.10-192.168,28.250

when the names of eth1 and eth2 have changed.
What about [re]naming those interface names using udev, i.e.
xx-persistent-net.rules file in /etc/udev/rules.d/ ?
That moves the problem from one place to another. I don't like "udev", I
don't use "udev". Especially with more than 1 NIC it makes more problems
than it solves.


Although you don't like udev, I think it's an important part of your final solution. Quite possibly it's already working (as intended) and is the reason you observe some of the effects that you do? Without a udev solution anything you come up with is likely more brittle than needs to be. I don't mean to imply that you shouldn't do what you are doing (although I'm unsure what your config would be to do what you want to do), but do learn about udev as well

On your machine check /etc/udev/rules.d/70-persistent-net.rules (could be something slightly different on different distros though)

Many distros will automatically maintain a file with lines like:
# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1d:7d:05:f2:30", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

There is even a script to add these lines and you can quite easily hack it and plug in your own script (use copy and paste?) which generates lines like the above based on the system detected at boot (say)

Also I need to do some highly dynamic config and what I do is use the script feature of dhcpcd (which works for static and dynamic config, it's more than just a dhcp client). This builds various configs for me on demand. Couple that with the ability for dnsmasq to accept config files in pieces, plus it's dbus access, and you can actually achieve very dynamic configs without too much trouble. Perhaps examine the scripts in the openresolv package for inspiration (this builds dns configs dynamically for dnsmasq)

Good luck

Ed W

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to