-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Provide changing source IP address bind to network interface. #223
base: master
Are you sure you want to change the base?
Conversation
@jzrk This looks pretty good, I have not seen this before. Looks like you will need to rebase. Also, can you add some unit tests? Also this may be nit-picking, but do you mind renaming |
It would be ideal if we could have this as an extras dep and not add it to the base requirements. We do this for various other features like Kerberos and CredSSP support where we provide the base package with enough to get you started and then provide optional extras. The main concern is that this would now be an extra library for Ansible users to deal with and keeping that to a minimum is a good thing for us. |
@badcure Looks like we have a different opinions here. @nitzmahone , @jborean93 what do you think? By the way, SourceAddressAdapter from requests_toolbelt uses
|
I don't have a preference on the name, personally I would try and align with the underlying library if it makes sense but that's just me. |
@jborean93 Ahh, good point. I don't foresee this feature being used too often. @diyan So I agree 100% with your explanation, but I was thinking(i.e. assuming) that a non-insignificant portion of the users may not have that background. That is why I was leaning the other way. Also from my experience, I naturally associate "bind" to be both the interface and IP, but this allows for the IP only. That said, |
Hello, Gents! Regarding to my change: purposely I decided to use
As @diyan said, it is also more ubiquitous to people who have moderate to advanced skills in networking. Of course, I am flexible and if we will decide on something I will change the name. Personally, I would suggest something with @badcure @jborean93 Of course, I will rebase the branch and I will add all suggestions. I do not have big experience with Python, because I am rather low-level programmer but I will try to add tests :) It will be good practice. So, I am asking for the indulgence. :) Summarizing, current changelist is:
Is there anything else? |
Nope, that looks good! bind_address works for me at least. If no one else speaks up, that should be fine. |
This change provides changing source IP address bind to the network interface.
It is popular option in applications like
ssh(1)
(-b
parameter) andtelnet(1)
(-s
parameter).Example situation:
I have two IP addresses bind to one network interface:
By default, connections will be performed using first IP address: 10.0.8.82.
But for some reason I would like to use second IP address: 10.0.100.182.
In this example, I connect to the machine with Windows having WinRM protocol configured (IP: 10.0.234.157).
Without this patch, sniffed packets looks like below:
Defining
bind_to
parameter enables to see packets bind to my network interface:It is easy to use with Protocol class.
Example program looks like:
I also modified Session class and now it is able to use
bind_to
option too:During that operation, sniffed trafiic looks like:
I build sources and tested connections on my laptop with FreeBSD and Python 2.7.8.