Io uso questa funzione.

Public Function getIPstring() As String
'This downloads the source of whatismyip.com
Dim wclient As New System.Net.WebClient
Try
'Download the source to the temp path
wclient.DownloadFile("http://www.findmyipaddress.com//", Application.StartupPath & "\Temp\ip.txt")
Catch
'If there is a problem it will be caught and will return and error message
Dim errorString As String = "Unable to get IP."
Return errorString
Exit Function
End Try

'This creates the filestream and streamreader that is used to read the source
Dim FS As New System.IO.FileStream(Application.StartupPath & "\Temp\ip.txt", IO.FileMode.Open)
Dim SR As New System.IO.StreamReader(FS)

'Here is where we start looking for the ip. This is the line we are trying to find.
'<h1> Your IP is XXX.XXX.XXX.XXX
</h1>

'This puts the entire file into a string
Dim entirefile As String = SR.ReadToEnd

'This gets the starting position of the ip address
Dim startIndex As Integer = entirefile.IndexOf("My IP Address")

'This reads 15 characters from the begginning of the ip
Dim restOfTheLine As String = entirefile.Substring(startIndex + 15, 15)

'If the ip is shorter that 15 characters this cuts off any extra characters
Dim theIp As String = restOfTheLine.TrimEnd("<", ">", "b", "r", "/", "h", "1", " ")

'Close the filestream and streamreader
SR.Close()
FS.Close()

'Dispose of the source once we get out ip in a String
Kill(Application.StartupPath & "\Temp\ip.txt")
Labelip.Text = (theIp)
Config.LabelIp.Text = (theIp)
'Return the ip in string format
Return theIp

End Function