resolv.conf, Heal Thyself
Posted by notKlaatu , 07 June 2009 · 372 views
Further adventures in being a noob and trying to play on networks:So I've got Fedora 11 running in Qemu and I'm out at this cafe and I can't get online in Qemu. My host OS can get online fine, just not the [Q]emulated OS.So I do the usual network troubleshooting...
bash$ ping google.comHost unknownWell that means I'm not even getting outside of my virtual machine, because if it could get out of the machine it would at least have told me the host was unreachable. But this message is telling me that it can't even take a stab at who or what I mean when I say to ping "google.com"OK, well since hostnames are pretty much the sole domain of DNS, I figure there's one place to look: /etc/resolv.confWell, first I do an ifconfig just to make sure I'm all configured. Turns out I didn't even have an IP address...lol. What a noob. But that's easily fixed:
bash$ ifconfig eth0 Link encap:Ethernet HWaddr 01:1F:23:F4:2B:19 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:16Now, don't be fooled...I'm not really hardwired in. I'm just virtually hardwired from my Qemu machine to my real machine's wifi connection.Anyway, to get the IP address:
bash$ su -c 'dhclient'bash$ ifconfig eth0 Link encap:Ethernet HWaddr 01:1F:23:F4:2B:19 inet addr:10.0.2.17 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe70::22e:44aa:fec8:29c2/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:16OK, now I'm back on track. I have IP address, I still have no inets. Just to be sure, I pinged again and got the same response so, yeah, I really do have DNS problems.So we need to look at what /etc/resolv.conf says:
bash$ less /etc/resolv.conf: generated by something-or-anothernameserver 10.0.1.1nameserver 10.0.1.2...or something like that. Totally unfamiliar and obviously not working. Well, my host OS is getting out onto the www so why not look at its resolv.conf file:
bash-hostOS_$ less /etc/resolv.confdomain freeUnsecureWifi.netsearch freeUnsecureWifi.netnameserver 10.61.32.1nameserver 184.108.40.206So I just copy all that information into the /etc/resolv.conf of my virtual machine's /etc/resolv.conf and...I'm online.End of story.Alternate Ending:Then I thought, well, maybe I should try using openDNS's nameservers just for kicks.
bash$ vi /etc/resolv.confdomain hackerpublicradio.comsearch hackerpublicradio.comnameserver 220.127.116.11nameserver 18.104.22.168And well whaddya know, it still works. I like Linux.