Skip to contentSkip to conversation

IPv6 Dynamic gateways in separate routing tables

DISCUSSION Adrian Moreno 2 participants 3 messages Oct 9, 2013

lore
Share & tools
lore
#0 lore raw

Hi all,

I have a multihomed system (very similar to the one described in LARTC HowTo Section 4.2. Routing for multiple uplinks/providers) with IPv6 addresses.
I want to create a routing table per interface to be able to route the traffic depending on the source address using IPv6 addresses and dynamic gateways. How do I set the default gateway to be dynamic in a separate routing table?

My current configuration is:
    IF_1: Interface 1
    SUBNET_1: the subnet connected to Interface 1
    IPv6_1: IPv6 address configured on Interface 1
    T_1: Routing table for Interface 1

    IF_2: Interface 2
    SUBNET_2: the subnet connected to Interface 2
    IPv6_2: IPv6 address configured on Interface 2
    T_2: Routing table for Interface 2

Configuration:
    ip -6 route add $SUBNET_1 dev $IF_1 table $T_1
    ip -6 rule add from $IPv6_1 table $T_1

I am clearly missing one route, that should look like:
    ip -6 route add default via <GATEWAY_1> tab $T_1
How should I set this route to use the dynamically obtained gateway?

The dynamic gateways are listed in the "default" routing table as:
    % ip -6 route show default
    default via DYNAMIC_GWv6_1 dev IF_1 proto kernel metric ....
    default via DYNAMIC_GWv6_2 dev IF_2 proto kernel metric ....

The order in which these routes are listed is arbitrary (restarting /etc/init.d/networking re-shuffles them).
Is there a way to ensure that a packet being sent from IPv6_1 goes out via the correct gateway (DYNAMIC_GWv6_1) and interface (IF_1)?
Many thanks in advance for any help.

Adrian

#1 lore raw

Hi Adrian,

You're implementing policy based routing. You should use iproute2's ip rule " ip -6 rule ... " to enforce source to gateway mapping.

Remy

Quoted 46 lines · Adrian Moreno

Hi all,

I have a multihomed system (very similar to the one described in LARTC HowTo Section 4.2. Routing for multiple uplinks/providers) with IPv6 addresses.

I want to create a routing table per interface to be able to route the traffic depending on the source address using IPv6 addresses and dynamic gateways. How do I set the default gateway to be dynamic in a separate routing table?

My current configuration is:
IF_1: Interface 1
SUBNET_1: the subnet connected to Interface 1
IPv6_1: IPv6 address configured on Interface 1
T_1: Routing table for Interface 1

IF_2: Interface 2
SUBNET_2: the subnet connected to Interface 2
IPv6_2: IPv6 address configured on Interface 2
T_2: Routing table for Interface 2

Configuration:
ip -6 route add $SUBNET_1 dev $IF_1 table $T_1 ip -6 rule add from $IPv6_1 table $T_1

I am clearly missing one route, that should look like:
ip -6 route add default via <GATEWAY_1> tab $T_1
How should I set this route to use the dynamically obtained gateway?

The dynamic gateways are listed in the "default" routing table as:
% ip -6 route show default
default via DYNAMIC_GWv6_1 dev IF_1 proto kernel metric .... default via DYNAMIC_GWv6_2 dev IF_2 proto kernel metric ....

The order in which these routes are listed is arbitrary (restarting /etc/init.d/networking re-shuffles them). Is there a way to ensure that a packet being sent from IPv6_1 goes out via the correct gateway (DYNAMIC_GWv6_1) and interface (IF_1)?

Many thanks in advance for any help.

Adrian

--
To unsubscribe from this list: send the line "unsubscribe lartc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Adrian Moreno

Hi Remy,

Quoted 1 line

You're implementing policy based routing. You should use iproute2's ip rule " ip -6 rule ... " to enforce source to gateway mapping.

I am. I am using ip -6 rule to enforce route lookup to a separate routing table:

  "ip -6 rule add from $IPv6_1 table $T_1"

but I don't know how to add a default route in table $T_1 that uses the dynamic gateway. If I don't add any default gateway route in $T_1, any address that doesn't match the subnet route ( "ip -6 route add $SUBNET_1 dev $IF_1 table $T_1" ), will be routed to the first default gateway that is listed in "ip -6 route show default". That is obviously not a valid solution because the order of those gateways is not predictable.

Thanks.
Adrian

----- Original Message -----
From: Remy Mudingay
Sent: 10/09/13 03:12 PM
To: Adrian Moreno
Subject: Re: IPv6 Dynamic gateways in separate routing tables
Hi Adrian,

You're implementing policy based routing. You should use iproute2's ip rule " ip -6 rule ... " to enforce source to gateway mapping.

Remy

Quoted 38 lines · Adrian Moreno

Hi all,

I have a multihomed system (very similar to the one described in LARTC HowTo Section 4.2. Routing for multiple uplinks/providers) with IPv6 addresses.

I want to create a routing table per interface to be able to route the traffic depending on the source address using IPv6 addresses and dynamic gateways. How do I set the default gateway to be dynamic in a separate routing table?

My current configuration is:
IF_1: Interface 1
SUBNET_1: the subnet connected to Interface 1
IPv6_1: IPv6 address configured on Interface 1
T_1: Routing table for Interface 1

IF_2: Interface 2
SUBNET_2: the subnet connected to Interface 2
IPv6_2: IPv6 address configured on Interface 2
T_2: Routing table for Interface 2

Configuration:
ip -6 route add $SUBNET_1 dev $IF_1 table $T_1
ip -6 rule add from $IPv6_1 table $T_1

I am clearly missing one route, that should look like:
ip -6 route add default via <GATEWAY_1> tab $T_1
How should I set this route to use the dynamically obtained gateway?

The dynamic gateways are listed in the "default" routing table as:
% ip -6 route show default
default via DYNAMIC_GWv6_1 dev IF_1 proto kernel metric .... default via DYNAMIC_GWv6_2 dev IF_2 proto kernel metric ....

The order in which these routes are listed is arbitrary (restarting /etc/init.d/networking re-shuffles them). Is there a way to ensure that a packet being sent from IPv6_1 goes out via the correct gateway (DYNAMIC_GWv6_1) and interface (IF_1)?

Many thanks in advance for any help.

Quoted 8 lines

Adrian

--
To unsubscribe from this list: send the line "unsubscribe lartc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe lartc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html