background preloader

Using Multiple Gateways (Routing)

Facebook Twitter

Two default routes. Linux has very advanced routing, filtering and traffic shaping options. Here is how to configure a system with two default routes. 1. Installation To activate Linux advanced routing on a Debian GNU/Linux system, install the iproute package: ~# apt-get install iproute This will create the /etc/iproute2/ directory. 2. From a command line on any Linux system, you can see the existing routing table by simply typing route at the prompt (or /sbin/route if /sbin is not in your path).

Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 * 255.255.255.0 U 0 0 0 eth1 default my.host.com 0.0.0.0 UG 0 0 0 eth1 Advanced routing commands are issued as arguments to the ip command. 192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.20 default via 192.168.1.10 dev eth1 3. Typically, a host connected to a network, such as the Internet, will have one default route and one Internet (WAN) interface. In theory such packets can be routed, but are dropped by ISPs. Linux networking - Why ip route add doesn't work, but ip route add with less details and then change works?

Two Default Gateways on One System - Thomas-Krenn-Wiki. This article will describe the setup for two or more default gateways under Linux. Problem Description You have built two or more network cards into one Linux system and each of these cards has its own default gateway. By default, you can only have one default gateway on a system. The case described would lead to asynchronous routing, whereby the router would reject the packets as appropriate. Solution The iproute2 program, which is included in all current Linux distributions and already installed even, as a rule, can be used for the solution of this problem. Normally, a Linux system only has one routing table, in which only one default gateway can make entries. Initial Position We will assume that we have two interfaces: eth0 and eth1. . # This file describes the network interfaces available on your system # and how to activate them.

Adding a Second Routing Table To add a new routing table, the file, /etc/iproute2/rt_tables must be edited. Configuring the New Routing Table Routing Rules Links. 12.04 - ip route with two default gateways. Multiple default gateways. Networking - Adding two default gateways in Debian interfaces file. Iproute2 cheat sheet. Overview iproute2 is the Linux networking toolkit that replaced net-tools (ifconfig, route, arp etc.) Old style network utilities like ifconfig and route are still there just for backwards compatibility and do not provide access to new features like policy-based routing or network namespaces. Note that iproute2 has been a standard Linux tool since the early 2000's. It's included in every distro by default, or at least available from the repos (OpenWRT is one of the cases). iproute2 was originally written by Alex Kuznetsov and is now maintained by Stephen Hemminger. This document aims to provide comprehensive but easy to use documentation for the ip command included in iproute2 package.

Instead of listing commands and describing what they do, it lists common tasks network administrators need to perform and gives commands to solve them, hence cheatsheet. Contributions are always welcome, you can find the “source code” at github.com/dmbaturin/iproute2-cheatsheet. General notes Address management. Multiple Default Gateways, Windows. Good Ideas for Network Setup. File Server/LAN Network, Registry Tuning.