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

Cannot bind local socket to addr: Cannot assign requested address #311

Closed
RamyaAshika opened this issue Dec 6, 2018 · 21 comments
Closed

Comments

@RamyaAshika
Copy link

I have tried with coturn configuration with my local system using my local IP address. It worked. But now, I'm trying to configure this using my public IP. Is it possible? and I'm doing this using Cygwin, can i able to configure this in my system with my public IP address?

@misi
Copy link
Contributor

misi commented Dec 6, 2018

It should work.
(Un)Fortunately I don't have Cygwin only linux.
(Cygwin is not recommended for production AFAIK)
Try it on debian linux and I could help more..

@misi
Copy link
Contributor

misi commented Dec 6, 2018

I miss your IP and logs..
It should work with any public global ipv4 address and IPv6 address too..

@RamyaAshika
Copy link
Author

RamyaAshika commented Dec 6, 2018

Ok FIne. Before that, I want to clarify this doubt.See my local ip address xxx.xxx.xx something like this and these are the steps I followed
STEP 1: $ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
$ tar xvfz libevent-2.0.21-stable.tar.gz
$ cd libevent-2.0.21-stable
$ ./configure
$ make
$ make install
Completed

STEP 2: We assume that you are installing the Coturn from the sources.Downloaded the latest version

$ tar xvfz turnserver-<...>.tar.gz
$ ./configure
$ make
$ make install

STEP 3: Add the long-term TURN users with the turnadmin utility. For example, this command adds user ninefinger with password youhavetoberealistic, realm north.gov, to the default sqlite database:

$ sudo turnadmin -a -u ninefingers -r north.gov -p youhavetoberealistic

STEP 4: For example, this command adds the admin user bayaz with password magi:

$ sudo bin/turnadmin -A -u bayaz -p magi

STEP 5:
From this link I have changed my turnserver.conf and turnuserdb.conf
https://www.webrtc-experiment.com/docs/TURN-server-installation-guide.html#windows

Finally I ran with this command
turnserver -L -a -f -r

@misi

screenshot 703

@RamyaAshika
Copy link
Author

RamyaAshika commented Dec 6, 2018

I have done these steps for my local my address. this is the result I got it and I dunno whether its working or not but its not throwing any error and in my firewall its showing like this
screenshot 704

Whether it works??
@misi

@RamyaAshika
Copy link
Author

But the main thing for me is I'm having my public ip address from there people will access my application. In that I want to use this. so obviously I need to use my public address instead of this local ip address. In that what my doubt is can I able to configure for my public ip address from my internal system/local system. @misi

@misi
Copy link
Contributor

misi commented Dec 6, 2018

Run it with:
turnserver -L x.x.x.x -a -f -r yourdomain.com

  • where x.x.x.x is your local ip address where it should listen. (You can skip it. It will discover all address)
    • If you behind nat then use -X y.y.y.y with your global ip y.y.y.y and set in your NAT the portforwarding to all TURN/STUN and RTP/RTCP ports.
  • yourdomain.com is your realm. (If you don't have own domain then use any string)

@misi
Copy link
Contributor

misi commented Dec 6, 2018

If your pc not behind nat then x.x.x.x and y.y.y.y are the same.

@RamyaAshika
Copy link
Author

RamyaAshika commented Dec 6, 2018

ooh k But I didn't get this point

  1. If you behind nat then use -X y.y.y.y with your global IP y.y.y.y and set in your NAT the port forwarding to all TURN/STUN and RTP/RTCP ports.

Whether this is what you're saying? When running the final command for my public IP address from my local system. Instead of this command,
turnserver -L -a -f -r
Do I need to run this command?
turnserver -X <public_ip_address> -a -f -r
@misi

@misi
Copy link
Contributor

misi commented Dec 6, 2018

The realm/domain is missing only. e.g. example.org
turnserver -X <public_ip_address> -a -f -r example.org

@RamyaAshika
Copy link
Author

Omg. This is what I'm getting. I have changed my config file like this

listening-port=3478
tls-listening-port=5349
alt-listening-port=3479
alt-tls-listening-port=5350
listening-ip=xxx.xxx.xx.xxx
listening-ip=xxx.xxx.xx.xxx
relay-ip=xxx.xxx.xx.xxx
min-port=49152
max-port=65535
verbose
fingerprint
#use-auth-secret
#static-auth-secret
userdb=/etc/turnuserdb.conf
realm=xxx.xxx.xx.xxx
cert=/etc/ssl/certificate.pem
pkey=/etc/ssl/private.key
dh-file=/etc/turn/dhparam.pem
no-stdout-log
log-file=/var/log/turn/turn.log
lt-cred-mech
user=iCore:iCore@123

no-sslv3
no-tlsv1

and I ran this command
turnserver -X <xxx.xxx.xx.xxx> -a -f -r example.org

0: Trying to bind fd 40 to <192.168.42.172:3478>: errno=125 Cannot bind local socket to addr: Cannot assign requested address 0: Cannot bind DTLS/UDP listener socket to addr 192.168.42.172:3478 0: Trying to bind DTLS/UDP listener socket to addr 192.168.42.172:3478, again... bind: Cannot assign requested address

@misi

@RamyaAshika
Copy link
Author

Where is the logs will be there? If you need I may send you @misi

@misi
Copy link
Contributor

misi commented Dec 6, 2018

IP
Make sure your ipv4 address is 192.168.42.172
cmd
ipconfig /all

if your global address is y.y.y.y

config

listening-port=3478
tls-listening-port=5349
alt-listening-port=3479
alt-tls-listening-port=5350
listening-ip=192.168.42.172
relay-ip=192.168.42.172
external-ip=y.y.y.y
min-port=49152
max-port=65535
verbose
fingerprint
#use-auth-secret
#static-auth-secret
userdb=/etc/turnuserdb.conf
realm=example.org
cert=/etc/ssl/certificate.pem
pkey=/etc/ssl/private.key
dh-file=/etc/turn/dhparam.pem
no-stdout-log
log-file=/var/log/turn/turn.log
lt-cred-mech
user=iCore:iCore@123

no-sslv3
no-tlsv1

Run
Run turnserver without any parameter

turnserver

@RamyaAshika
Copy link
Author

Ya I have checked in my global ip address through Putty but I don't see any ip address like this 192.168.42.172 and on my local my ip address also there is no ip address like this. @misi

@RamyaAshika
Copy link
Author

Whether you got any idea @misi

@misi
Copy link
Contributor

misi commented Dec 7, 2018

Replace 192.168.42.172 with your local ip address...

@RamyaAshika
Copy link
Author

This is how I have given

listening-port=3478
tls-listening-port=5349
alt-listening-port=3479
alt-tls-listening-port=5350
listening-ip=localipaddress
relay-ip=localipaddress
external-ip=online/publicipaddress
min-port=49152
max-port=65535
verbose
fingerprint
#use-auth-secret
#static-auth-secret
userdb=/etc/turnuserdb.conf
realm=icoretek.com
cert=/etc/ssl/certificate.pem
pkey=/etc/ssl/private.key
dh-file=/etc/turn/dhparam.pem
no-stdout-log
log-file=/var/log/turn/turn.log
lt-cred-mech
user=iCore:iCore@123

no-sslv3
no-tlsv1

and ran the command
$ turnserver -L localipaddress -a -f -r icoretek.com

now its not showing any error whether its connected? @misi

@RamyaAshika
Copy link
Author

Please Can I know which [turn_server_ip_address] we need to add here in pc_config variable?
var pc_config = {"iceServers": [{"url": "stun:stun.l.google.com:19302"},
{"url":"turn:my_username@<turn_server_ip_address>",
"credential":"my_password"}]};
pc_new = new webkitRTCPeerConnection(pc_config);

@misi

@RamyaAshika
Copy link
Author

Hey Hi Misi,
Now I'm currently running this project on Centos Linux. I have followed all the steps
https://www.webrtc-experiment.com/docs/TURN-server-installation-guide.html#centos
which is given in the link for centos.

and finally for running the command
I have used this.
turnserver -v -r ip:port -a -b turnuserdb.conf -c turnserver.conf -u turn-username:password

but after that I'm getting
Cannot bind local socket to addr:PERMISSION DENIED like that I'm getting.

Any help?

@misi

@de-saksham
Copy link

@RamyaAshika Were you able to solve this issue? If yes, could you please help!

@renaudallard
Copy link

I have exactly the same issue if coturn doesn't run as root.

@tlsharkey
Copy link

systemctl may already be running coturn on your server (particularly if you install through apt). Try killing first (as sudo): systemctl stop coturn. Then running turnserver. Worked for me on Ubuntu 20.04 server.

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

5 participants