Your message dated Mon, 7 Dec 2015 13:11:39 +0100
with message-id <[email protected]>
and subject line Re: Bug#807322: ifup assigns gateway to wrong interface
has caused the Debian Bug report #807322,
regarding ifup assigns gateway to wrong interface
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
807322: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807322
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: ifupdown
Version: 0.7.53.1

The gateway directive in the interfaces file assigns a default gateway to
the wrong interface:

e.g.


With static config:
--------------------------

auto p2p1
iface p2p1 inet static
    address 10.41.3.4/24
    gateway 10.41.3.254

auto p3p1
iface p3p1 inet static
    address 10.41.104.7/24
    gateway 10.41.104.254

Gives:

ip addr = 10.41.3.4/24
ip addr = 10.41.104.7/25

route -n

0.0.0.0 10.41.3.254 UG p2p1
<link-local-routes>

[fails at boot / ifup with RTNETLINK: file exists]

Should be:

ip addr = 10.41.3.4/24
ip addr = 10.41.104.7/25

route -n

0.0.0.0 10.41.3.254 UG p2p1
0.0.0.0 10.41.105.254 UG p3p1
<link-local-routes>


With dhcp
---------------

auto p2p1
iface p2p1 inet dhcp

auto p3p1
iface p3p1 inet dhcp

<same result>

The gateway option should, surely, assign the route to the interface for which
it is being specified?

A work around can be had by using a post-up entry, but isn't this incorrect
behaviour with the gateway option? There is no reason why there can't
be two default routes, one per interface

--- End Message ---
--- Begin Message ---
On Mon, Dec 07, 2015 at 11:53:01AM +0000, Jason Spashett wrote:

> auto p2p1
> iface p2p1 inet static
>     address 10.41.3.4/24
>     gateway 10.41.3.254
> 
> auto p3p1
> iface p3p1 inet static
>     address 10.41.104.7/24
>     gateway 10.41.104.254
> 
> Gives:
> 
> route -n
> 
> 0.0.0.0 10.41.3.254 UG p2p1
> <link-local-routes>
> 
> Should be:
> 
> route -n
> 
> 0.0.0.0 10.41.3.254 UG p2p1
> 0.0.0.0 10.41.105.254 UG p3p1
> <link-local-routes>
> 
> The gateway option should, surely, assign the route to the interface for which
> it is being specified?

The behavior of ifupdown is correct (therefore closing the bug). Routes
are not assigned to interfaces, instead routes are added to the routing
table, and tell the kernel which interface to choose given a destination
IP address. Adding two gateway routes normally doesn't work, because
then the kernel wouldn't know which interface to choose. What you can do
is tell the kernel that one gateway route has a different priority than
the other, by assigning it a metric (smaller value means higher
priority):

auto p2p1 inet static
        address 10.41.3.4/24
        gateway 10.41.3.254
        metric 10

auto p3p1 inet static
        address 10.41.104.7/24
        gateway 10.41.104.254
        metric 20

This will give preference to the gateway route via 10.41.3.254, but if
p2p1 goes down, it will use 10.41.104.254 instead. The "metric" option
is also supported if you use dhcp instead of static.

-- 
Met vriendelijke groet / with kind regards,
      Guus Sliepen <[email protected]>

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply via email to