IP aliases implementations: which one to use?

Hello everyone,
I'm exploring OpenWrt since a while and I've that the system has two different implementations of IP aliases.

The first one is documented here and it creates a new interface for each alias.
Example:

config interface 'lan'
	option device 'br-lan'
 	option proto 'static'
	option ipaddr '192.168.100.238'
	option netmask '255.255.255.0'
 	option gateway '192.168.100.1'

config interface 'alias1'
	option proto 'static'
	option device 'br-lan'
	option ipaddr '192.168.100.235'
	option netmask '255.255.255.0'

The second one is not documented (at least I didn't find any wiki page about it) and it's something like this:

 config interface 'lan'
 	option device 'br-lan'
 	option proto 'static'
 	option gateway '192.168.100.1'
	list ipaddr '192.168.100.238/24'
	list ipaddr '192.168.100.235/24'

Please note that ipaddr has changed type from option to list.

My question is: what is the correct way to setup an alias?
What are the pro and cons of each implementation?

Thank you in advance!

1 Like

Both are valid. In the first case you have distinctive logical interfaces and can assign them to different zones or bind them to specific services.

4 Likes