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

How to set up this service on ECS servers and cloud servers? I want to detect the current NAT type on the client side The server only has one public IP and one internal IP #59

Open
apsara2825 opened this issue Apr 26, 2024 · 4 comments

Comments

@apsara2825
Copy link

No description provided.

@jselbie
Copy link
Owner

jselbie commented Apr 26, 2024

Groan... I used to know how to do this quite well. But now it appears that Amazon has changed how to setup multi-network instances.

Ok, I see how to do this now. It's not obvious.

In the "Network Settings" panel for the instance configuration before you launch it... click "Edit"

image

Change the subnet option from "No preference" to an explicit selection.

image
  • Choose an option that is not "No preference"

That should activate the visibility of the "Advanced network configuration" drop down:

image

At the bottom of that expansion, there's a button for "Add network interface"

image

I forgot how I did this last year. But it appears that I use one elastic IP address and assigned that to the secondary adapter.

As for the Stunserver code itself. Explicitly use the --primaryadvertised and --altadvertised command line parameter and specify the public ip addresses as each.

Then use the --primaryinterface and --altinterface command line parameters to specify which local (private) ip address the code should listen for.

Example:

./stunserver --ddp --mode full --family 4 --protocol udp --primaryinterface 172.31.10.101 --altinterface 172.31.10.102 --primaryadvertised 3.135.212.85 --altadvertised 3.132.228.249

@jselbie
Copy link
Owner

jselbie commented Apr 26, 2024

Does this help?

@apsara2825
Copy link
Author

这有帮助吗?

Thank you very much for your reply. I have followed your method carefully, but my ECS server can only be assigned one public IPV4, but there can be multiple private 192.168.0.0/16 addresses. Do you need two public addresses to achieve NAT type detection

@apsara2825
Copy link
Author

Does this help?
My server is not an elastic ECS. I tried to purchase an elastic public network, but it prompted me that I cannot bind to my ECS instance. This is too regrettable

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