ifupdown-multi-0.1.1/0000755000000000000000000000000012221130320011344 5ustar ifupdown-multi-0.1.1/COPYRIGHT0000644000000000000000000000107212221130320012637 0ustar Copyright (c) 2013 by Farsight Security, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ifupdown-multi-0.1.1/LICENSE0000644000000000000000000002613612221130320012361 0ustar Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ifupdown-multi-0.1.1/README.md0000644000000000000000000000605212221130320012626 0ustar ifupdown-multi ============== `ifupdown-multi` integrates support for multiple default gateways on independent network connections into the Debian `ifupdown` network interface configuration system. It adds new `multi_*` options to the `/etc/network/interfaces` file format in order to more easily configure Linux's policy based routing. The policy information used to configure each network interface using `ifupdown-multi` is saved when `ifup` is run. This allows network interfaces using `ifupdown-multi` to be brought up or down cleanly as needed. Installation ------------ The `ifupdown-multi` Debian package should be used if possible. Manual installation can be accomplished by running the following commands: ``` # install -m 0755 ifupdown-multi.py /usr/local/lib/ifupdown-multi.py # ln -sf /usr/local/lib/ifupdown-multi.py /etc/network/if-up.d/ifupdown-multi # ln -sf /usr/local/lib/ifupdown-multi.py /etc/network/if-down.d/ifupdown-multi ``` `ifupdown-multi` is implemented in Python and requires the Python runtime to be installed on the system and available during boot. Configuration ------------- See the [ifupdown-multi-interfaces(5)](man/ifupdown-multi-interfaces.5.rst) manpage for details. The following example shows a basic configuration with two network interfaces attached to two Internet providers. ``` auto eth0 iface eth0 inet static address 198.51.100.123 netmask 255.255.255.0 multi_table 1 multi_gateway 198.51.100.1 auto eth1 iface eth1 inet static address 203.0.113.234 netmask 255.255.255.0 multi_table 2 multi_gateway 203.0.113.1 ``` Caveats ------- + Do not specify a prefix in `multi_gateway_prefixes` that overlaps one of the subnets directly attached to the host. + IPv6 is supported, but it is implemented in a slightly different way than IPv4. The `multi_gateway_weight` option is not supported for IPv6 gateways. The first IPv6 gateway configured is used instead, unless a specific prefix is configured to use a particular gateway using the `multi_gateway_prefixes` option. + `ifup` disables stateless address autoconfiguration when the `static` method is used with the `inet6` address family, however it does *not* disable the learning of routes from IPv6 router advertisements. It is recommended to place an executable script in the `/etc/network/if-pre-up.d` directory containing something like the following contents: ``` #!/bin/sh if test "$IFACE" = "--all"; then exit 0 fi if test "$METHOD" != "static"; then exit 0 fi IFACE="$(echo $IFACE | cut -f1 -d:)" echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_dad echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra_defrtr echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra_pinfo echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra_rtr_pref echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_redirects echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_source_route echo 0 > /proc/sys/net/ipv6/conf/$IFACE/dad_transmits ``` ifupdown-multi-0.1.1/debian/0000755000000000000000000000000012221130320012566 5ustar ifupdown-multi-0.1.1/debian/changelog0000644000000000000000000000024212221130320014436 0ustar ifupdown-multi (0.1.1) unstable; urgency=low * Initial release. (Closes: #724452) -- Robert S. Edmonds Thu, 26 Sep 2013 18:10:07 -0400 ifupdown-multi-0.1.1/debian/compat0000644000000000000000000000000212221130320013764 0ustar 9 ifupdown-multi-0.1.1/debian/control0000644000000000000000000000170112221130320014170 0ustar Source: ifupdown-multi Section: admin Priority: optional Maintainer: Robert S. Edmonds Build-Depends: debhelper (>= 9), python Standards-Version: 3.9.4 Vcs-Git: git://github.com/farsightsec/ifupdown-multi.git Vcs-Browser: https://github.com/farsightsec/ifupdown-multi Package: ifupdown-multi Architecture: all Depends: ${misc:Depends}, python Enhances: ifupdown Description: multiple default gateway support for ifupdown This package integrates support for multiple default gateways on independent network connections into the Debian ifupdown network interface configuration system. It adds new "multi_*" options to the /etc/network/interface file format in order to more easily configure Linux's policy based routing. . The policy information used to configure each network interface using ifupdown-multi is saved when ifup is run. This allows network interfaces using ifupdown-multi to be brought up or down cleanly as needed. ifupdown-multi-0.1.1/debian/copyright0000644000000000000000000000153412221130320014524 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Source: git://github.com/farsightsec/ifupdown-multi Files: * Copyright: 2013, Farsight Security, Inc. License: Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. . On Debian systems, the complete text of the Apache version 2.0 license can be found in "/usr/share/common-licenses/Apache-2.0". ifupdown-multi-0.1.1/debian/docs0000644000000000000000000000001212221130320013432 0ustar README.md ifupdown-multi-0.1.1/debian/gbp.conf0000644000000000000000000000004412221130320014203 0ustar [buildpackage] pristine-tar = False ifupdown-multi-0.1.1/debian/install0000644000000000000000000000003212221130320014152 0ustar ifupdown-multi.py usr/lib ifupdown-multi-0.1.1/debian/links0000644000000000000000000000017412221130320013633 0ustar usr/lib/ifupdown-multi.py etc/network/if-up.d/ifupdown-multi usr/lib/ifupdown-multi.py etc/network/if-down.d/ifupdown-multi ifupdown-multi-0.1.1/debian/manpages0000644000000000000000000000004012221130320014276 0ustar man/ifupdown-multi-interfaces.5 ifupdown-multi-0.1.1/debian/rules0000755000000000000000000000012712221130320013646 0ustar #!/usr/bin/make -f %: dh $@ --with python2 override_dh_compress: dh_compress -X.md ifupdown-multi-0.1.1/debian/source/0000755000000000000000000000000012221130320014066 5ustar ifupdown-multi-0.1.1/debian/source/format0000644000000000000000000000001512221130320015275 0ustar 3.0 (native) ifupdown-multi-0.1.1/ifupdown-multi.py0000755000000000000000000001571612221130320014716 0ustar #!/usr/bin/env python # Copyright (c) 2013 by Farsight Security, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import errno import glob import logging import os import subprocess import sys process_name = os.path.basename(sys.argv[0]) required_keys = ( 'MODE', 'ADDRFAM', 'IFACE', 'IF_ADDRESS', 'IF_MULTI_TABLE', 'IF_MULTI_GATEWAY', ) additional_keys = ( 'IF_MULTI_GATEWAY_WEIGHT', 'IF_MULTI_PREFERRED_PREFIXES', ) fname_prefix = '/var/run/network/ifupdown-multi.' fname_nexthop = fname_prefix + '%(IFACE)s.nexthop.%(ADDRFAM)s' fname_rules = fname_prefix + '%(IFACE)s.rules.%(ADDRFAM)s' glob_nexthop = fname_prefix + '*.nexthop.%(ADDRFAM)s' priority_magic = 25357 priority_magic_preferred = 31047 def run(cmd): logging.debug('running command %r', cmd) rc = subprocess.call(cmd, shell=True) if rc != 0: logging.critical('command %r failed with exit code %d', cmd, rc) return rc def mkdir(dname): if not os.path.isdir(dname): rc = run('mkdir %s' % dname) if rc != 0: raise Exception, 'unable to create directory %s' % dname class ifupdownMulti: def __init__(self, env): mkdir('/var/run/network') self.cfg = {} for key in required_keys: if env.has_key(key): self.cfg[key] = env[key] else: raise Exception, 'missing environment variable %s' % key for key in additional_keys: if env.has_key(key): if key == 'IF_MULTI_GATEWAY_WEIGHT' and self.cfg['ADDRFAM'] == 'inet6': logging.warning('multi_gateway_weight not supported with IPv6') else: self.cfg[key] = env[key] if not self.cfg['MODE'] in ('start', 'stop'): raise Exception, 'unknown ifupdown mode %s' % self.cfg['MODE'] if self.cfg['ADDRFAM'] == 'inet': self.cfg['ip'] = 'ip' elif self.cfg['ADDRFAM'] == 'inet6': self.cfg['ip'] = 'ip -6' table_id = int(self.cfg['IF_MULTI_TABLE']) self.cfg['PRIORITY_PREFERRED'] = priority_magic_preferred + table_id self.cfg['PRIORITY'] = priority_magic + table_id self.fname_nexthop = fname_nexthop % self.cfg self.fname_rules = fname_rules % self.cfg self.glob_nexthop = glob_nexthop % self.cfg def dispatch(self): if self.cfg['ADDRFAM'] in ('inet', 'inet6'): if self.cfg['MODE'] == 'start': self.start() elif self.cfg['MODE'] == 'stop': self.stop() def flush_route_cache(self): run('%(ip)s route flush cache' % self.cfg) def start_rule(self, rule): rule = rule % self.cfg with open(self.fname_rules, 'a') as w: w.write(rule + '\n') run('%s rule add %s' % (self.cfg['ip'], rule)) def start_route(self, route): route = route % self.cfg run('%s route replace %s' % (self.cfg['ip'], route)) def restart_nexthops(self): if self.cfg['ADDRFAM'] == 'inet': nexthops = set() for fname in glob.glob(self.glob_nexthop): for line in open(fname): nexthops.add(line.strip()) if nexthops: nexthops = sorted(list(nexthops)) cmd = self.cfg['ip'] + ' route replace default scope global ' + ' '.join(nexthops) run(cmd) else: run('%(ip)s route delete default' % self.cfg) def start_gateway(self): if self.cfg['ADDRFAM'] == 'inet': self.start_route('default via %(IF_MULTI_GATEWAY)s dev %(IFACE)s table %(IF_MULTI_TABLE)s proto static') nexthop = 'nexthop via %(IF_MULTI_GATEWAY)s dev %(IFACE)s' % self.cfg weight = self.cfg.get('IF_MULTI_GATEWAY_WEIGHT') if weight: nexthop += ' weight ' + weight elif self.cfg['ADDRFAM'] == 'inet6': nexthop = 'default via %(IF_MULTI_GATEWAY)s src %(IF_ADDRESS)s dev %(IFACE)s' % self.cfg run('%s route replace %s table %s proto static' % (self.cfg['ip'], nexthop, self.cfg['IF_MULTI_TABLE'])) run('%s route append %s' % (self.cfg['ip'], nexthop)) with open(self.fname_nexthop, 'w') as w: w.write(nexthop) w.write('\n') self.restart_nexthops() def stop_gateway(self): if self.cfg['ADDRFAM'] == 'inet': self.restart_nexthops() elif self.cfg['ADDRFAM'] == 'inet6': try: with open(self.fname_nexthop, 'r') as f: nexthop = f.readline().strip() if nexthop: run('%s route delete %s' % (self.cfg['ip'], nexthop)) except IOError, e: if e.errno != errno.ENOENT: raise def start(self): self.start_rule('from %(IF_ADDRESS)s table %(IF_MULTI_TABLE)s priority %(PRIORITY)s') self.start_rule('to %(IF_ADDRESS)s table %(IF_MULTI_TABLE)s priority %(PRIORITY)s') preferred_prefixes = self.cfg.get('IF_MULTI_PREFERRED_PREFIXES') if preferred_prefixes: for prefix in preferred_prefixes.split(): self.cfg['PREFIX'] = prefix self.start_rule('to %(PREFIX)s table %(IF_MULTI_TABLE)s priority %(PRIORITY_PREFERRED)s') self.start_gateway() self.flush_route_cache() def stop_rules(self): if os.path.exists(self.fname_rules): for line in open(self.fname_rules): rule = line.strip() run(self.cfg['ip'] + ' rule delete ' + rule) try: logging.debug('unlinking %s', self.fname_rules) os.unlink(self.fname_rules) except OSError: pass def stop(self): run('%(ip)s route flush table %(IF_MULTI_TABLE)s' % self.cfg) try: logging.debug('unlinking %s', self.fname_nexthop) os.unlink(self.fname_nexthop) except OSError: pass self.stop_gateway() self.stop_rules() self.flush_route_cache() def main(): if not 'IF_MULTI_TABLE' in os.environ: sys.exit(0) if not os.getenv('MODE') in ('start', 'stop'): sys.exit(0) if os.getenv('VERBOSITY') == '1': level = logging.DEBUG else: level = logging.WARNING logging.basicConfig(format=process_name+': %(levelname)s: %(message)s', level=level) ifupdownMulti(os.environ).dispatch() if __name__ == '__main__': main() ifupdown-multi-0.1.1/man/0000755000000000000000000000000012221130320012117 5ustar ifupdown-multi-0.1.1/man/ifupdown-multi-interfaces.50000644000000000000000000001204212221130320017310 0ustar .\" Man page generated from reStructuredText. . .TH IFUPDOWN-MULTI-INTERFACES 5 "17 September 2013" "0.1.0" "File formats" .SH NAME ifupdown-multi-interfaces \- ifupdown-multi extension for the interfaces(5) file format . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH DESCRIPTION .sp \fI/etc/network/interfaces\fP contains network interface information for the \fBifup\fP(8) and \fBifdown\fP(8) commands. This manpage describes the \fBifupdown\-multi\fP extensions to the the standard \fBinterfaces\fP(5) file format. .sp The \fBifupdown\-multi\fP extensions to \fBifupdown\fP integrate Linux\(aqs policy routing based support for multiple default gateways on independent network connections. These extensions can replace a typical shell script based approach that directly invokes a sequence of \fBip\fP(8) commands for configuring multiple uplinks with declarative syntax in the \fI/etc/network/interfaces\fP file. .sp \fBifupdown\-multi\fP records the policy information used to bring up each network interface when \fBifup\fP(8) is run and removes the same policy routing information when \fBifdown\fP(8) is run. .SH IFACE OPTIONS .sp The standard \fBaddress\fP and \fBnetmask\fP options must be set for each interface. The \fBgateway\fP option must \fINOT\fP be set. .sp The new \fBmulti_gateway\fP and \fBmulti_table\fP options must be set to configure policy routing with \fBifupdown\-multi\fP\&. .sp Additionally, the \fBmulti_gateway_weight\fP and \fBmulti_preferred_prefixes\fP options can be specified in order to control optional policy routing features. .INDENT 0.0 .TP .B \fBmulti_gateway\fP \fIaddress\fP Default gateway for this interface. (Required.) .TP .B \fBmulti_table\fP \fIid\fP Table identifier. This must be a numeric value, and each interface must have a unique value. Recommended range: 1\-1000. (Required.) .TP .B \fBmulti_gateway_weight\fP \fIweight\fP Set this gateway\(aqs weight. This value is directly passed as the \fIweight\fP parameter to the \fInexthop\fP part of an \fBip\-route\fP(8) route object. Higher values indicate higher relative bandwidth or quality. (Optional.) .TP .B \fBmulti_preferred_prefixes\fP \fIprefix\fP [\fIprefix\fP]... Prefer this connection for the given prefixes. This option configures the routing policy database using the \fBip\-rule\fP(8) command to use this connection for the specified prefixes. (Optional.) .UNINDENT .SH EXAMPLES .sp The following example shows a basic configuration with two network interfaces. \fIeth0\fP is on the 198.51.100.0/24 network, while \fIeth1\fP is on the 203.0.113.0/24 network. Each interface stanza has a "multi_gateway" option, as opposed to the usual "gateway" option. Each interface stanza also needs a "multi_table" option, whose parameter is a small, unique non\-negative integer. (This number will be used internally to uniquely identify an interface\-specific routing table.) .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C auto eth0 iface eth0 inet static address 198.51.100.123 netmask 255.255.255.0 multi_table 1 multi_gateway 198.51.100.1 auto eth1 iface eth1 inet static address 203.0.113.234 netmask 255.255.255.0 multi_table 2 multi_gateway 203.0.113.1 .ft P .fi .UNINDENT .UNINDENT .sp The following example shows a more complicated setup using optional \fBifupdown\-multi\fP parameters. It is similar to the first example, but the network connection on \fIeth0\fP is preferred for most connections, and several network prefixes prefer to use one or the other network connection. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C auto eth0 iface eth0 inet static address 198.51.100.123 netmask 255.255.255.0 multi_table 1 multi_gateway 198.51.100.1 multi_gateway_weight 5 multi_preferred_prefixes 10.0.0.0/8 auto eth1 iface eth1 inet static address 203.0.113.234 netmask 255.255.255.0 multi_table 2 multi_gateway 203.0.113.1 multi_gateway_weight 1 multi_preferred_prefixes 172.16.0.0/12 192.168.0.0/16 .ft P .fi .UNINDENT .UNINDENT .SH FILES .INDENT 0.0 .TP .B \fI/etc/network/interfaces\fP System\-wide network interface configuration. See \fBinterfaces\fP(5). .TP .B \fI/var/run/network/ifupdown\-multi.*\fP State information used by \fBifupdown\-multi\fP\&. .UNINDENT .SH SEE ALSO .sp \fBinterfaces\fP(5), \fBifup\fP(8), \fBip\fP(8), \fBip\-route\fP(8), \fBip\-rule\fP(8). .INDENT 0.0 .TP .B Linux Advanced Routing & Traffic Control HOWTO \-\- Chapter 4: Rules. \fI\%http://www.tldp.org/HOWTO/Adv\-Routing\-HOWTO/lartc.rpdb.html\fP .UNINDENT .\" Generated by docutils manpage writer. . ifupdown-multi-0.1.1/man/ifupdown-multi-interfaces.5.rst0000644000000000000000000001041212221130320020116 0ustar ifupdown-multi-interfaces ========================= ---------------------------------------------------------- ifupdown-multi extension for the interfaces(5) file format ---------------------------------------------------------- :Date: 17 September 2013 :Version: 0.1.0 :Manual section: 5 :Manual group: File formats DESCRIPTION ----------- `/etc/network/interfaces` contains network interface information for the **ifup**\(8) and **ifdown**\(8) commands. This manpage describes the **ifupdown-multi** extensions to the the standard **interfaces**\(5) file format. The **ifupdown-multi** extensions to **ifupdown** integrate Linux's policy routing based support for multiple default gateways on independent network connections. These extensions can replace a typical shell script based approach that directly invokes a sequence of **ip**\(8) commands for configuring multiple uplinks with declarative syntax in the `/etc/network/interfaces` file. **ifupdown-multi** records the policy information used to bring up each network interface when **ifup**\(8) is run and removes the same policy routing information when **ifdown**\(8) is run. IFACE OPTIONS ------------- The standard **address** and **netmask** options must be set for each interface. The **gateway** option must *NOT* be set. The new **multi_gateway** and **multi_table** options must be set to configure policy routing with **ifupdown-multi**. Additionally, the **multi_gateway_weight** and **multi_preferred_prefixes** options can be specified in order to control optional policy routing features. **multi_gateway** *address* Default gateway for this interface. (Required.) **multi_table** *id* Table identifier. This must be a numeric value, and each interface must have a unique value. Recommended range: 1-1000. (Required.) **multi_gateway_weight** *weight* Set this gateway's weight. This value is directly passed as the *weight* parameter to the *nexthop* part of an **ip-route**\(8) route object. Higher values indicate higher relative bandwidth or quality. (Optional.) **multi_preferred_prefixes** *prefix* [*prefix*]... Prefer this connection for the given prefixes. This option configures the routing policy database using the **ip-rule**\(8) command to use this connection for the specified prefixes. (Optional.) EXAMPLES -------- The following example shows a basic configuration with two network interfaces. *eth0* is on the 198.51.100.0/24 network, while *eth1* is on the 203.0.113.0/24 network. Each interface stanza has a "multi_gateway" option, as opposed to the usual "gateway" option. Each interface stanza also needs a "multi_table" option, whose parameter is a small, unique non-negative integer. (This number will be used internally to uniquely identify an interface-specific routing table.) :: auto eth0 iface eth0 inet static address 198.51.100.123 netmask 255.255.255.0 multi_table 1 multi_gateway 198.51.100.1 auto eth1 iface eth1 inet static address 203.0.113.234 netmask 255.255.255.0 multi_table 2 multi_gateway 203.0.113.1 The following example shows a more complicated setup using optional **ifupdown-multi** parameters. It is similar to the first example, but the network connection on *eth0* is preferred for most connections, and several network prefixes prefer to use one or the other network connection. :: auto eth0 iface eth0 inet static address 198.51.100.123 netmask 255.255.255.0 multi_table 1 multi_gateway 198.51.100.1 multi_gateway_weight 5 multi_preferred_prefixes 10.0.0.0/8 auto eth1 iface eth1 inet static address 203.0.113.234 netmask 255.255.255.0 multi_table 2 multi_gateway 203.0.113.1 multi_gateway_weight 1 multi_preferred_prefixes 172.16.0.0/12 192.168.0.0/16 FILES ----- `/etc/network/interfaces` System-wide network interface configuration. See **interfaces**\(5). `/var/run/network/ifupdown-multi.*` State information used by **ifupdown-multi**. SEE ALSO -------- **interfaces**\(5), **ifup**\(8), **ip**\(8), **ip-route**\(8), **ip-rule**\(8). Linux Advanced Routing & Traffic Control HOWTO -- Chapter 4: Rules. http://www.tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.rpdb.html ifupdown-multi-0.1.1/man/update0000755000000000000000000000016512221130320013331 0ustar #!/bin/sh -e rm -f ifupdown-multi-interfaces.5 rst2man ifupdown-multi-interfaces.5.rst > ifupdown-multi-interfaces.5