Get Azure public IP address from deployed app
Asked Answered
U

2

1

I'm implementing the PASV mode in a FTP server, and I send to the client the IP address and port of the data end point. This is stupid because the IP is actually where the client is already connecting, so there ire two options:

  1. How could I get the public IP address from a given instance? Not the VIP, but the public one.

  2. How could I get the original target IP address that the user used from a Socket object? Considering routers and load balancers in the middle :P

An answer to any of this questions would do, although there is another way that could work... may I get the public IP address doing a DNS look up of myapp.cloudapp.net?

A fourth option would be use the Azure Management API library... but, too much trouble :P.

Cheers.

Unbending answered 16/3, 2011 at 17:19 Comment(0)
H
1

Not sure if you ever figured this out, but here's my take on it. The individual role instances are all behind the Windows Azure load balancer and have no idea what the original, outward-facing IP address is. Also, there's no Management API call that returns IP address - Get Deployment returns the URL but not the IP address. I think the only option is going to be a dns lookup.

Having said that: I don't think you can host a passive ftp server in your role instance (at least not elegantly). You may open up to 25 input endpoints on your role (up from 5 - see my recent blog post about this update), but there's manual work involved in the configuration. I don't know if your ftp application lets you limit your port range to such a small number of ports. Also:

  • You'd have to define each port as its own input endpoint (this is the manual labor part I mentioned) - input endpoints don't allow a port range to be specified, unlike the internal endpoints.
  • You'd have to specify the port number that's used internally, and the port numbers would need to be sequential

One last thing on ftp: you should be able to host an sftp server with no trouble, since all traffic comes through one port.

Hiroshima answered 28/5, 2011 at 4:19 Comment(1)
Hi. Well, basically... I'm gonna use an external sever to return the public IP adress, that is what Filezilla server does. And I have a first version of my pasive FTP server working hehe. The only problem, is that it only support 4 concurrent connections from the same IP address, but I think it will be ok! Cheers.Unbending
T
0

The hack that I'm contemplating right now is to retrieve http://www.icanhazip.com/. It isn't elegant and is subject to the availability of that service, but it gets the job done. A better solution would be appreciated!

Therese answered 23/4, 2014 at 21:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.