2 # mako template function to create a bridge
4 # mako defs provide the advantage of declaring predefined functions in
7 # Below is an example that illustrates how to define such functions and use
8 # them in the /etc/network/interfaces file to create bridges
10 # This file defines a function makebr to create a bridge. The arguments to the
11 # function are vlan and ip address of the bridge.
13 # The default directory for template functions is
14 # /etc/network/ifupdown2/templates/. Copy this file under the template
15 # dir (create the directory if does not exist)
17 # To use this template function in /etc/network/interfaces, add the following
18 # to the /etc/network/interfaces file:
20 # <%namespace name="bridge" file="/bridge_template"/>
22 # ${bridge.makebr(1096, "10.0.23.2/24")}
23 # ${bridge.makebr(1097, "10.0.23.3/24")}
27 <%def name="makebr(vlan, addr)">
29 iface br${vlan} inet static
31 bridge-ports swp1.${vlan} swp2.${vlan}