New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create multihop default gateways #171

Closed
tomislacker opened this Issue Aug 10, 2015 · 11 comments

Comments

Projects
None yet
2 participants
@tomislacker
Contributor

tomislacker commented Aug 10, 2015

Based on the documentation & grokking through the code, it doesn't seem possible to make a round-robin default gateway. Example:

$ ip r show table default
default  proto static 
        nexthop via 222.111.222.1  dev eth0 weight 1
        nexthop via 111.222.111.2  dev eth1 weight 3
  • If this doesn't exist, how difficult would it be to implement? (Admittedly, I'm not sure how I'd go about it)
  • If this does already exist, could the docs be updated to include the usage?
@tomislacker

This comment has been minimized.

Show comment
Hide comment
@tomislacker

tomislacker Aug 10, 2015

Contributor

For what it's worth, when you have two hops, you can find two 16-byte segments that seem to describe the uplinks:

  • Hop 1: 10 00 00 00 02 00 00 00 08 00 05 00 d0 4a 27 69
  • Hop 2: 10 00 00 02 03 00 00 00 08 00 05 00 46 11 0b 01

So far, I can say for certain that:

  1. 4th byte seems to be somewhat related to the preference...
  2. 5th byte is the ifindex
  3. Last 4 bytes are the IPv4 address of the hop

I'll be spending some time later today or tomorrow trying to decode more & reading into the kernel source.

Contributor

tomislacker commented Aug 10, 2015

For what it's worth, when you have two hops, you can find two 16-byte segments that seem to describe the uplinks:

  • Hop 1: 10 00 00 00 02 00 00 00 08 00 05 00 d0 4a 27 69
  • Hop 2: 10 00 00 02 03 00 00 00 08 00 05 00 46 11 0b 01

So far, I can say for certain that:

  1. 4th byte seems to be somewhat related to the preference...
  2. 5th byte is the ifindex
  3. Last 4 bytes are the IPv4 address of the hop

I'll be spending some time later today or tomorrow trying to decode more & reading into the kernel source.

@svinota

This comment has been minimized.

Show comment
Hide comment
@svinota

svinota Aug 11, 2015

Owner

No, it is not implemented yet. Will be done soon.

Owner

svinota commented Aug 11, 2015

No, it is not implemented yet. Will be done soon.

@svinota svinota added the fr label Aug 11, 2015

svinota added a commit that referenced this issue Aug 11, 2015

@svinota

This comment has been minimized.

Show comment
Hide comment
@svinota

svinota Aug 11, 2015

Owner

Nexthop msg are supported — yet only for decoding.

NH messages are represented as array inside NLA, but a bit specific array, and the issue is that it is not so easy to make a generic solution that would work with all NLA array cases — I would not like to have individual array-specific routines in different message classes.

But it's doable anyway, decoding is done and encoding will be delivered tomorrow.

Still are not implemented RTA_VIA and RTA_FLOW, but it also will be done soon.

Owner

svinota commented Aug 11, 2015

Nexthop msg are supported — yet only for decoding.

NH messages are represented as array inside NLA, but a bit specific array, and the issue is that it is not so easy to make a generic solution that would work with all NLA array cases — I would not like to have individual array-specific routines in different message classes.

But it's doable anyway, decoding is done and encoding will be delivered tomorrow.

Still are not implemented RTA_VIA and RTA_FLOW, but it also will be done soon.

svinota added a commit that referenced this issue Aug 11, 2015

netlink: use class-specific `msg_align()`
Different nlmsg types may require different alignment. So, `RTA_MULTIPATH`
is aligned to 2, not 4.

Bug-Url: #171

svinota added a commit that referenced this issue Aug 11, 2015

svinota added a commit that referenced this issue Aug 11, 2015

@svinota

This comment has been minimized.

Show comment
Hide comment
@svinota

svinota Aug 11, 2015

Owner

Encoding from raw NLA notation done, see the syntax in the test code (1026a69).

Next will be helper and docs update.

Owner

svinota commented Aug 11, 2015

Encoding from raw NLA notation done, see the syntax in the test code (1026a69).

Next will be helper and docs update.

svinota added a commit that referenced this issue Aug 11, 2015

svinota added a commit that referenced this issue Aug 12, 2015

svinota added a commit that referenced this issue Aug 12, 2015

svinota added a commit that referenced this issue Aug 12, 2015

@svinota

This comment has been minimized.

Show comment
Hide comment
@svinota

svinota Aug 12, 2015

Owner

Multipath management, yet with gateway option only:

IPDB: http://docs.pyroute2.org/ipdb.html#routing-management
IPRoute: http://docs.pyroute2.org/iproute.html#pyroute2.iproute.IPRouteMixin.route

Support for RTA_VIA and RTA_FLOW will be done next week, or you can try to play with it yourself. On this week there is an important task about MPLS routing support.

Owner

svinota commented Aug 12, 2015

Multipath management, yet with gateway option only:

IPDB: http://docs.pyroute2.org/ipdb.html#routing-management
IPRoute: http://docs.pyroute2.org/iproute.html#pyroute2.iproute.IPRouteMixin.route

Support for RTA_VIA and RTA_FLOW will be done next week, or you can try to play with it yourself. On this week there is an important task about MPLS routing support.

@svinota

This comment has been minimized.

Show comment
Hide comment
@svinota

svinota Aug 22, 2015

Owner

Does it work, may I close the bug?

Owner

svinota commented Aug 22, 2015

Does it work, may I close the bug?

@tomislacker

This comment has been minimized.

Show comment
Hide comment
@tomislacker

tomislacker Oct 19, 2015

Contributor

@svinota sorry for never responding on this. I think we can probably close it. The only reason I even ended up coming back to this issue is because I was going to make a new issue to inquire if you wanted to update the documentation to deprecate this functionality. As of the merge of kill_rtcache into the kernel, and it's release in ~3.6, weighted default routes no longer work. The new recommended implementation of weighted default routes is similar to this.

Contributor

tomislacker commented Oct 19, 2015

@svinota sorry for never responding on this. I think we can probably close it. The only reason I even ended up coming back to this issue is because I was going to make a new issue to inquire if you wanted to update the documentation to deprecate this functionality. As of the merge of kill_rtcache into the kernel, and it's release in ~3.6, weighted default routes no longer work. The new recommended implementation of weighted default routes is similar to this.

@svinota

This comment has been minimized.

Show comment
Hide comment
@svinota

svinota Oct 19, 2015

Owner

Ok, thanks. Will update docs too.

Owner

svinota commented Oct 19, 2015

Ok, thanks. Will update docs too.

@svinota svinota added the docs label Oct 19, 2015

@tomislacker

This comment has been minimized.

Show comment
Hide comment
@tomislacker

tomislacker Oct 19, 2015

Contributor

Sounds good. The [proprietary] project I'm working on currently is to create a daemon for a CPE product that handles multi-WAN setups in light of the route cache removal and is actually what led me to pyroute2 in the first place. Once I get through the project, I intend to make an OSS example that I can publish. I'll let you know if/when I get to that point in case you're interested in also linking to that.

Contributor

tomislacker commented Oct 19, 2015

Sounds good. The [proprietary] project I'm working on currently is to create a daemon for a CPE product that handles multi-WAN setups in light of the route cache removal and is actually what led me to pyroute2 in the first place. Once I get through the project, I intend to make an OSS example that I can publish. I'll let you know if/when I get to that point in case you're interested in also linking to that.

@svinota

This comment has been minimized.

Show comment
Hide comment
@svinota

svinota Oct 19, 2015

Owner

Yep, sure. Thanks :)

Owner

svinota commented Oct 19, 2015

Yep, sure. Thanks :)

svinota pushed a commit that referenced this issue Oct 28, 2015

@svinota

This comment has been minimized.

Show comment
Hide comment
@svinota

svinota Oct 28, 2015

Owner

Updated. Thanks again.

Owner

svinota commented Oct 28, 2015

Updated. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment