File: interfaces_bridge_template_func

package info (click to toggle)
ifupdown2 3.0.0-1.3
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,088 kB
  • sloc: python: 24,681; sh: 476; makefile: 215
file content (33 lines) | stat: -rw-r--r-- 1,006 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
# mako template function to create a bridge
#
# mako defs provide the advantage of declaring predefined functions in
# separate files.
#
# Below is an example that illustrates how to define such functions and use
# them in the /etc/network/interfaces file to create bridges
#
# This file defines a function makebr to create a bridge. The arguments to the
# function are vlan and ip address of the bridge.
#
# The default directory for template functions is
# /etc/network/ifupdown2/templates/. Copy this file under the template
# dir (create the directory if does not exist)
#
# To use this template function in /etc/network/interfaces, add the following
# to the /etc/network/interfaces file:
#
# <%namespace name="bridge" file="/bridge_template"/>
#
# ${bridge.makebr(1096, "10.0.23.2/24")}
# ${bridge.makebr(1097, "10.0.23.3/24")}
#
#

<%def name="makebr(vlan, addr)">
auto br${vlan}
iface br${vlan} inet static
    address ${addr}
    bridge-ports swp1.${vlan} swp2.${vlan}
    bridge-stp on
</%def>