In the Linux implementation of the IP stack a IP address belongs to the host event though the administrator configures it on a devices. This can cause somewhat unexpected behaviour when multiple interfaces are configured to use the same network.
When multiple interfaces are configured for the same network you must use policy routing to make the internal IP stack route the packages out on the designated interface. This is done by using the “ip route” command.
The following options must be enabled in the kernel.
You also need the iproute suite, also known as iproute2. In Debian (and Debian derivatives) this is the iproute package.
Example configuration for two interfaces on the same IP subnet
In Debian (and Debian derivatives) the easiest way to add the additional routes on start-up is to use the up option in
Note:The table id is just a positive integer in the range 0-255 that identifies a unique table. When setting up multiple interfaces on the same subnet this id needs to be unique for each interface. In the example the interface number times 10 is used. Table id 0 and 253-255 are reserved for internal use and may not be used for this configuration.
For more information about advanced Linux routing please see read the Linux Advanced Routing & Traffic Control HOWTO.
Book tip: “Linux Network Internals”