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

Failed to assign IP: 87 on Win 10 pro #6

Closed
Pelayori opened this issue Jul 5, 2023 · 23 comments
Closed

Failed to assign IP: 87 on Win 10 pro #6

Pelayori opened this issue Jul 5, 2023 · 23 comments

Comments

@Pelayori
Copy link

Pelayori commented Jul 5, 2023

image

@wow0000
Copy link
Owner

wow0000 commented Jul 5, 2023

Hello,
I would need more informations than a single screenshot in order to help you. Please respond with details such as: Your network configurations, command line arguments etc

@Pelayori
Copy link
Author

Pelayori commented Jul 5, 2023

.\GRETunnel.exe 192.168.1.12 205.220.230.176 23.183.244.131 10.10.214.14

image

If you need anything else let me know please

@Pelayori
Copy link
Author

Pelayori commented Jul 5, 2023

This command arguments have worked for several windows instances, but doesn't seem to work on some.

@wow0000
Copy link
Owner

wow0000 commented Jul 5, 2023

23.183.244.131: Our IP on the tunnel
10.10.214.14: GRE Server IP on the tunnel

Please try to use something like 10.10.214.XXX instead of 23.183.244.131 (If you use an GRE tunnel provider, they should give you the correct value)

23.183.244.131 Could be your Public interface IP if I'm not mistaken
Please let me know if it does help you

@Pelayori
Copy link
Author

Pelayori commented Jul 5, 2023

I will try, however I've ran the command with the public IP provided to me on multiple Windows system, I am curious as to why it won't work like this this time.

(I might take some hours to try it out)

@wow0000
Copy link
Owner

wow0000 commented Jul 5, 2023

The issue concerns this part:

const char* bind_ip = argv[3];

MIB_UNICASTIPADDRESS_ROW AddressRow;
InitializeUnicastIpAddressEntry(&AddressRow);
WintunGetAdapterLUID(Adapter, &AddressRow.InterfaceLuid);
AddressRow.Address.Ipv4.sin_family = AF_INET;
inet_pton(AF_INET, bind_ip, &AddressRow.Address.Ipv4.sin_addr.S_un.S_addr);

AddressRow.OnLinkPrefixLength = cidr;
AddressRow.DadState = IpDadStatePreferred;
auto LastError = CreateUnicastIpAddressEntry(&AddressRow);
// LastError -> Windows does not want to assign the IP to the interface

I suspect argv[3] (23.183.244.131) to be incorrect. It should be in the same subnet as the GRE server (10.10.214.14/30) and should use private IP blocks

@Pelayori
Copy link
Author

Pelayori commented Jul 5, 2023

The public IP is statically routed to the private one (or viceversa), if that makes it any different

@Pelayori
Copy link
Author

Pelayori commented Jul 6, 2023

The error goes away if we use private IPs, but the traffic does not get routed to the public IP

@Pelayori
Copy link
Author

Pelayori commented Jul 7, 2023

The issue is solved, however I am unable to route the local gre ip (10.10.214.XXX) to the public IP. Could you give me some insight on this?

@wow0000
Copy link
Owner

wow0000 commented Jul 7, 2023

Hello,
I'm sorry for the late in answers, I would need details on what you mean by "route the local gre ip to the public IP". The program should already be doing it for you automatically (if settings are correct)

@Pelayori
Copy link
Author

Pelayori commented Jul 7, 2023

No worries on delays, the software works good just something with my config.

On the GRE endpoint, they have routed the traffic from the GRE remote IP address to the public one we have over the internet.

The traffic does not arrive the public IP so I would like to route traffic from 10.10.XXXX to another public IP.

With some IPs that are valid, I can do a command like this one, and the traffic gets routed to the public IP
.\GRETunnel.exe 192.168.1.12 205.220.230.176 23.183.244.131 10.10.214.14

@wow0000
Copy link
Owner

wow0000 commented Jul 7, 2023

If I'm understanding correctly you want to be able to route multiple local IPs to multiple public IPs ? This case is not supported, one way to do it would be to run multiple instance of the software using a smaller CIDR mask and configuring the server accordingly

@Pelayori
Copy link
Author

Pelayori commented Jul 7, 2023

No, I just want 1 local ip to report to 1 public IP

10.10.214.XXX -> XXX.XXX.XXX.XXX

@wow0000
Copy link
Owner

wow0000 commented Jul 7, 2023

I see, the software should already be doing that, if it does not, double check your server configuration and/or arguments

Details about arguments:
.\GRETunnel.exe A B C D [E]
A: The network the program should use to communicate with the GRE server (Local ip of the interface)
B: IP the program should send the GRE packets to (the server IP)
C: The IP used as client local IP for the tunnel network
D: The GRE server IP on the tunnel network
E: CIDR of GRE network

@Pelayori
Copy link
Author

Pelayori commented Jul 7, 2023

Yes, this is my current command, however the public IP is not pingable:

.\GRETunnel.exe 192.168.1.172 205.220.230.176 10.10.214.57 10.10.214.58

If I swap out 10.10.214.57 for the public IP, it works but this is not ideal and doesn't work with all public IPs due to being on a different subnet.

@wow0000
Copy link
Owner

wow0000 commented Jul 7, 2023

I'm not sure how to help you, it truly looks like a configuration problem. I don't have any testing device available in order to test or debug the software at the moment to reproduce your issue.
Check your NAT/SNAT/Routes on the server side for 10.10.214.X/CIDR

@Pelayori
Copy link
Author

I have still not figured this out. Is it possible I need an static route in Window's side?

@wow0000
Copy link
Owner

wow0000 commented Jul 10, 2023

The software automatically create a virtual network with the provided settings, you shouldn't have to do anything on your end.

@Pelayori
Copy link
Author

Pelayori commented Jul 10, 2023

The public IP is statically routed in the server, but it cannot be reached after connecting the tunnel.

@wow0000
Copy link
Owner

wow0000 commented Jul 10, 2023

If the server cannot be reached, check your firewall rules and networks packets (wireshark). Some hosts may block GRE packets.

@Pelayori
Copy link
Author

The firewalls are all off. My host doesn't block GRE packets as if I swap the IPs as stated above it works. I'm lost.

@Pelayori
Copy link
Author

Maybe I have fixed it. I added the public IP address to the GRE_Tunnel adapter manually, and the routing is stablished now.

I will be confirming this works, and maybe if you are okay with it add an additional optional param for public IP and make a PR.

@Pelayori
Copy link
Author

This issue was solved for me, I have made a PR for it if you wish to review it.

Link: #7

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

No branches or pull requests

2 participants