Skip to content
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

Guess primary address #23

Open
Solvik opened this issue Aug 7, 2019 · 2 comments
Open

Guess primary address #23

Solvik opened this issue Aug 7, 2019 · 2 comments
Labels

Comments

@Solvik
Copy link
Owner

Solvik commented Aug 7, 2019

Netbox has the ability to flag an IP as Primary address for a Device

Since it's tied to the user workflow, I'd say we could enable this guess with a config argument and use the following workflow

  • parse the route table
  • find the source ip of the default route
  • flag this IP as Primary adresss
@ThomasADavis
Copy link
Contributor

interface = netifaces.gateways()['default'][netifaces.AF_INET][1]

will tell you which interface has the default route.

@Solvik
Copy link
Owner Author

Solvik commented Sep 7, 2019

Doesn't seem to handle every case:

>>> import netifaces
>>> netifaces.gateways()
{'default': {}}

In my case IP are announced via exabgp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants