Archive for the ‘Linux’ Category

Linux can not resolve hostname

Saturday, February 18th, 2012

I used a couple of hours today to find out why my laptop ( Ubuntu 10.04 ) could resolve the hostname of all other devices on my network, but my server ( Ubuntu Server 10.04 ) and desktop ( Ubuntu 11.10 ) could not. First I suspected it to be a misconfiguration in Samba, but after lot of searching in the /etc/samba/smb.conf i found that it didn’t have anything to do with my problem. It was not worthless because I learned a lot more about Linux and networking, and one thing that might be useful to others is this little commented line in the Samba config file:

name resolve order = lmhosts host wins bcast

Here you can change the order the different network protocols that should be resolved. What pointed me in the right direction was the command simple but very useful Linux command “dig” which stands for “domain information groper”. By simply typing:

dig

Which is very useful for troubleshooting network problems in general. Test it yourself by typing e.g.:

dig wikipedia.com

and you will get a very nice output on how the domain name is resolved. The part that helped me a was the third next line in the output:

; <<>> DiG 9.7.0-P1 <<>> wikipedia.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11524
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 3

;; QUESTION SECTION:
;wikipedia.com. IN A

;; ANSWER SECTION:
wikipedia.com. 1305 IN A 208.80.152.201

;; AUTHORITY SECTION:
wikipedia.com. 82430 IN NS ns2.wikimedia.org.
wikipedia.com. 82430 IN NS ns0.wikimedia.org.
wikipedia.com. 82430 IN NS ns1.wikimedia.org.

;; ADDITIONAL SECTION:
ns0.wikimedia.org. 1420 IN A 208.80.152.130
ns1.wikimedia.org. 1420 IN A 208.80.152.142
ns2.wikimedia.org. 1420 IN A 91.198.174.4

;; Query time: 11 msec
;; SERVER: 192.168.10.1#53(192.168.10.1)
;; WHEN: Sat Feb 18 16:09:39 2012
;; MSG SIZE rcvd: 162

On my laptop, the one that could resolve hostname the output was:

;; SERVER: 208.122.23.22#53(208.122.23.22)

This DNS server belongs to UnblockUS which is a service to unblock services that is for USA only. I used it to watch netflix.com in Norway. On the other computers the command printed out my ISP ‘s DNS primary server and there is no way a local hostname can be resolved by using a DNS server that is not connected to your local network (LAN). The reason that it worked  on my laptop I believe is that my UnblockUS subscription had expired and then my laptop used my router as a DNS server instead.

So finally, here is the Solution:

I checked my /etc/resolv.conf file and found that Ubuntu automatically fetched my ISP’s DNS server IPs and saved it here every time the network was getting the IP address from the DHCP server on the router. There is useless just to change the /etc/resolv.conf file because then it is overwritten every time the network daemon  starts. If you are using Gnome interface, right click on network icon > Edit Connections > IPv4 (tab) > Automatic (DHCP) addresses only (from the dropdown menu) and enter the IP address to your router in the DNS servers: field. The location may vary depending on which Ubuntu version you have and if you have wireless or wired connection, but you will find it if you look around the dialogue boxes.

On my headless server I used static DHCP on my router. I changed this to be a static IP on my server instead by editing /etc/network/interfaces using nano:

sudo nano /etc/network/interfaces

Before:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

After:

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.10.2
netmask 255.255.255.0
gateway 192.168.10.1

Change your /etc/network/interfaces according to your network configuration. Edit your /etc/resolv.conf  and add your router as nameserver:

nameserver 192.168.10.1

Feel free to comment if you find errors or have any questions.

 

Open letter to Livescribe

Friday, January 27th, 2012

Hi

I am a student at University of Oslo and a happy and proud user of a Livescribe pen. At the university we are trained to use Linux. Which distro we choose does not matter, so we are free to use Ubuntu which provide us a great community where Ubuntu users can get fantastic support and much more. Ubuntu also comes with a good software package handlers called “Software Center” or “Synaptic”. I have Windows installed side by side with Ubuntu on my computers, but the only reason for booting into Windows for me now is to synchronize my livescribe pen or watch and hear recorded lectures. The fact that there is no Linux version of LD is starting to get more and more time consuming, because I always do my exercises in Ubuntu. I will urge you to make a port for Linux, and if you do, Debian/Ubuntu would be a good place to start. Because Linux is very common on universities around the world I think this extra expenses porting LD to linux will pay off because Livescribe will (I believe) reach a much broader range of your target group. I hope you will take this into consideration and create a Linux version of LD. I do not have the programming skills to make a port myself, but if I could I would have done it for free. So my solicitation to Livescribe is to contact the community at e.g. Ubuntu (www.ubuntuforums.com) and ask if anybody is interested in cooperate with Livescribe to create a Linux port.

I will post this message on different forums to see if I can get some response from the community, and if I do I will let you know. In the mean time I would love to hear Livescribes plans on this subject.

Thank you!

Thomas Gabrielsen