What is "Attempt to lookup host entry for bad IP address" error? - iphone

Check this error and please help me.
2009-07-24 15:58:34.209 LBS[2636] Host 'staging.common.virtualearth.net' not found using 'gethostbyname()' - perhaps the hostname is wrong or networking is not set up on your machine
2009-07-24 15:58:34.209 LBS[2636] Attempt to lookup host entry for bad IP address (staging.common.virtualearth.net)
NOTE: you should run 'diskperf -y' to enable the disk statistics
I am running the objC codes for hitting a webservice on GNU for Windows.
Why is this error?

The first line says it can't find the IP address off the DNS servers.
The second is some kind of fallback with an incredibly cryptic error. Looks like it's trying reverse DNS using hostname as the IP address (hence bad IP address) or ARP resolution using hostname as IP address.
Basically fix the DNS to that host and both will be solved.

Related

Google Stun server stun.l.google.com change IP?

I was using the Google Stun server by IP 74.125.143.127, but since 21/09/2021 it seems Google changed the IP of DNS stun.l.google.com.
I know I should use DNS rather fixed IP.
Any guys have some confirmation about the IP change?
tks
I know I should use DNS rather fixed IP
Yes. That's the answer. Full stop. Don't hardcode IP addresses to services in your app. The whole point of DNS... well, you know this right?
Some recent DNS lookups:
stun.l.google.com: 74.125.197.127
stun1.l.google.com: 173.194.193.127
stun2.l.google.com: 172.253.112.127
stun3.l.google.com: 173.194.77.127
stun4.l.google.com: 172.217.215.127
Testing the old IP you referenced that's not in the DNS entries above:
>stunclient 74.125.143.127
Binding test: fail
Testing the IP address that's currently being returned:
>stunclient 173.194.193.127
Binding test: success
Local address: 192.168.1.18:55004
Mapped address: 1.2.3.4:55004

.gethostbyaddr() does not work on all devices. Why? (Python)

I wrote a script that goes through all local IPs in the '0' network (192.168.0.*).
I use a loop with socket.gethostbyaddr(ip_modified_by_the_loop_each_time).
The loop returns me 3 devices their hostnames.
Now, I found that it does not find 4 devices (at least).
It does wind my Windows Laptop, not my Android Phone. It does find
one MacBook, not the iMac, not the other MacBook. It also does not
find any phone.
I know that all the devices are online and have an IPv4 address.
I can ping them very well, it responds just fine. But when I use socket.gethostbyaddr(ip_modified_by_the_loop_each_time) it throws an error.
I used a try:/except: statement to get around the error, but it still can not find my phone by IP and get the hostname, but I know it is there.
I am using python 3.3
Why is that happening, how to fix that?
Thank you.
gethostbyaddr tries to find out the hostname for a given IP address by using either locally stored information (i.e. /etc/hosts) or doing a reverse DNS lookup. The result does not depend on the host being online or not, they only depend on the availability of these information.
And these information can also not be trusted. For example the DNS operator of a domain could add the following records:
test.example.com A public.ip.of.test
public.ip.of.test PTR localhost.
In this case a lookup (gethostbyname) of test.example.com would return the IP address of this host while a reverse lookup (gethostbyaddr) would claim that the hostname is localhost. And if the PTR record would be missing gethostbyaddr would fail, even if the host is online.
See also wikipedia: reverse dns lookup.

Connecting GNS3 to Internet.. curious about the IP

BTW!! I am able to connect to the internet via GNS3 Router. My question is about the IP Address that's assigned to the router!
Here it goes:
So this is my set up in GNS3:
Router 1 ---> Cloud (using my local MS loopback interface)
I had been struggling to get my router to the internet for a while. I'd run ipconfig and found that my wireless connection had an IP of 10.x.x.x with a gateway of .1. So obviously, I was trying to manually assign my MS loopback a random address of like 10.x.x.25 (/24, so still within the same subnet). But it never worked!!
Finally gave up, and then a new idea hit me. I set my MS loopback as "receive IP via DHCP", and also my GNS3 router interface that's facing the loopback cloud as "receive IP via DHCP".
They both received an IP Address of 192.168.x.x, and it connected to the internet as well. Duh.. no wonder my manual 10.x.x.x didn't work.
I did an ipconfig/all.... I just could not see a 192.168.x.x subnet in there at all.. no trace of it, just 10.x.x.x was present.
Where DID this 192.168.x.x IP come from? Difference between 10.x and the 192.x address?
Any help would be appreciated!
Nevermind, I think I figured it out. 10.x would be an IP address if it was handed out by my home router.
Here, since I allowed my Loopback to link up with my real router, my PC is behaving as a DHCP server instead, on behalf of my real home router. So 192.168.x is a pool belonging to my PC which handed out an IP to my virtual GNS3 router.
A traceroute to a google dns server revealed the works behind the scenes. It reach the 192.168.x.1 and THEN went to the 10.x.x.1. So my PC is like a proxy right?

Resolve hostname to IP address for Postfix

I'm trying to setup postfix in a VPC on AWS where an external server communicates with a postfix mail server in the same subnet.
I'm getting an error from postfix every time I try to connect to postfix from an external client. The error says:
warning: hostname example.com does not resolve to address 54.x.xxx.xxx
connect from unknown[54.x.xxx.xxx]
lost connection after CONNECT from unknown[54.x.xxx.xxx]
I'm suspecting this is related to the IP address that is being pointed to the hostname. When I run:
dig example.com
The 'answer' section outputs this:
;; ANSWER SECTION:
example.com. 60 IN A 10.0.1.132
I've looked at this link: http://www.postfix.org/LINUX_README.html
and I've tried editing /etc/host.conf and the /etc/postfix/main.cf file from that link and a bunch of other things from googling but nothing is working and I still get the same error mentioned above.
Is there a way to configure the VPC or the EC2 instance to point to my public IP address, or can I fix this problem trying to add some more configuration settings for postfix?

Can't connect to my webserver from external source

I am having problems connecting to my website from a source outside my local network. I had another server before running the same site. The only difference is the old one was FreeBSD and now I'm trying it on Linux.
Here is my setup: I'm using Apache2. The server is behind a Netgear router. I'm using a Freedns host name. I have ddclient updating my ip.
Here is what happens: I can look at my site from the server in Chrome or my phone connected to the local wifi. It works using either the host name or ip address. It does not load from my cell phone or from my desktop using a proxy for either the host name or the ip address (the external one from googling my ip and from the router's wan info page). When I try the proxy with the host name I get "conection timed out" error, and when I try the ip address I get "couldn't connect to host error".
Here is what I've tried: I enabled port forwarding to the server from and to port 80 to my lan ip address. I disabled the firewall on the server. I double checked that the host name is directed to the right ip address. I ensured that the ip address does indeed point to my router. I've watched wireshark on my server while trying to connect and don't see any incoming requests when I try to load it from my phone.
It seems like maybe my port forwarding isn't working, but on my router it says that that port forwarding rule is active.
I'm out of ideas as to why what else could be going wrong.