Aliases

Alias sections can be used to define further IPv4 and IPv6 addresses for interfaces. They also allow combinations like DHCP on the main interface and a static IPv6 address in the alias, for example to deploy IPv6 on wan while keeping normal internet connectivity. Each interface can have multiple aliases attached to it.

Create an 'interface' section per IP, but alias interfaces may NOT be of type bridge

  • For non-bridged interfaces (physdev , that is physical interfaces) the ifname is the <interface-of-network-for-same-phydev>
  • For cases where the interface is bridged the ifname is br-base-interface, where base-interface is the name of the primary IP's config section (e.g. for a the default lan interface config, the first alias would use ifname br-lan).

A minimal alias definition for a bridged interface might be (for a scenario without vlans):

config interface lan
        option 'ifname' 'eth0'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '192.168.1.1'
        option 'netmask' '255.255.255.0'
config interface lan2
       option 'ifname' 'br-lan'
       option 'proto' 'static'
       option 'ipaddr' '10.0.0.1'
       option 'netmask' '255.255.255.0'

or for a non-bridge interface

config interface lan
        option 'ifname' 'eth0'
        option 'proto' 'static'
        option 'ipaddr' '192.168.1.1'
        option 'netmask' '255.255.255.0'
config interface lan2
       option 'ifname' 'eth0'
       option 'proto' 'static'
       option 'ipaddr' '10.0.0.1'
       option 'netmask' '255.255.255.0'

To see a list of interfaces you can do ubus list network.interface.* and to view the ip of a particular interface (the UCI name not the physical interface), do ifstatus <interface> (e.g. ifstatus lan2).

Options for alias sections are listed below.

Name Type Required Default Description
interface string yes (none) Specifies the logical interface name of the parent (or master) interface this alias belongs to; must refer to one of the defined interface sections
proto string yes (none) Specifies the alias interface protocol
ipaddr ip address yes, if no ip6addr is set (none) alias IP address
netmask netmask yes, if no ip6addr is set (none) alias Netmask
gateway ip address no (none) Default gateway
broadcast ip address no (none) Broadcast address (autogenerated if not set)
ip6addr ipv6 address yes, if no ipaddr is set (none) IPv6 address (CIDR notation)
ip6gw ipv6 address no (none) IPv6 default gateway
dns list of ip addresses no (none) DNS server(s)
layer integer no 3 Selects the interface to attach to for stacked protocols (tun over bridge over eth, ppp over eth or similar).
3: attach to layer 3 interface (tun*, ppp* if parent is layer 3 else fallback to 2)
2: attach to layer 2 interface (br-* if parent is bridge else fallback to layer 1)
1: attach to layer 1 interface (eth*, wlan*)

FIXME please check if this is still true or not: At the time of writing, only the static protocol type is allowed for aliases.