Static IP in 2 VLAN setup

I believe to have found a solution to a problem I have in the openWRT documentation but I don't understand the explanation. The article I'm referring to is DNS and DHCP configuration examples

If I assign a static IP address to a MAC address in a set up with more than one interface how do I add a separate host entry to an interface as the documentation says I should?:

If you plan to connect more than one interface simultaneously, add a separate host entry for each interface, otherwise it's unreliable.

I'd say they mean more than one client interface.

1 Like

But what am I to specify and where do I write the code? If I take the code example from the documentation. Where do I put the interface part?:

config host 
  option ip 192.168.1.22 
  option mac 00:11:22:33:44:55
  option name mydesktop

Does config host above have an interface parameter or does interface have a host parameter?

config host 
  option ip 10.10.10.22 
  option mac 00:11:22:aa:bb:cc
  option name mydesktop-guest

It doesn't need an interface option. If the first interface with mac 00:11:22:33:44:55 connects to lan interface, it will get the 192.168 IP. If the second inteface with mac 00:11:22:aa:bb:cc connects to let's say guest interface it will get the 10.10 IP.

2 Likes

Your example doesn't work for me. You missed the point, it is about the words connect ... simultaneously

In my example both interfaces are connecting simultaneously. If this doesn't cover what you need, maybe you could explain it better so we don't have to guess.

2 Likes

This could be what I am looking for. The terminology is not easy the comprehend, I glanced at the wiki-page but I will need to read the section DNS and DHCP configuration /etc/config/dhcp in more detail. The dnsmasq is defined in the /etc/config/dhcp: is an instance of dnsmasq identified by the name of the interface in "config dnsmasq" ?

There's an example creating multiple dnsmasq instances.

In theory, it may be possible to handle with a single dnsmasq instance using /etc/dnsmasq.conf and filtering tags for the option --dhcp-host=.
The UCI config seems to provide only setting tags, not filtering.