]> git.proxmox.com Git - mirror_ifupdown2.git/blob - docs/examples/interfaces_bridge_template_func
.gitignore: pycharm remote execution update
[mirror_ifupdown2.git] / docs / examples / interfaces_bridge_template_func
1 #
2 # mako template function to create a bridge
3 #
4 # mako defs provide the advantage of declaring predefined functions in
5 # separate files.
6 #
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
9 #
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.
12 #
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)
16 #
17 # To use this template function in /etc/network/interfaces, add the following
18 # to the /etc/network/interfaces file:
19 #
20 # <%namespace name="bridge" file="/bridge_template"/>
21 #
22 # ${bridge.makebr(1096, "10.0.23.2/24")}
23 # ${bridge.makebr(1097, "10.0.23.3/24")}
24 #
25 #
26
27 <%def name="makebr(vlan, addr)">
28 auto br${vlan}
29 iface br${vlan} inet static
30 address ${addr}
31 bridge-ports swp1.${vlan} swp2.${vlan}
32 bridge-stp on
33 </%def>