Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to configure the IP address of my embedded device. The device should have a static IP address and I attempt to set this using the /etc/network/interfaces file with

iface eth0 inet static
   address 192.168.255.212
   netmask 255.255.255.0
   gateway 192.168.255.1

where I have been given these values by our network technician. My system is a minimal embedded system built with buildroot, uClibc and busybox. With this interfaces file, a call to ifconfig eth0 displays that the above settings have been enabled correctly, but I am unable to ping anything on my network. My question really is this: is the above interfaces file sufficient for setting a static IP or is something more necessary? From online tutorials, I see many mention of /etc/hosts and /etc/resolv.conf files. I don't even have a /etc/resolv.conf file on my system. I am having other problems as described here Unable to get embedded device to ping anything on the network so I am asking this question separately to verify that I am setting up the static IP address correctly and rule out an incorrect setup.

EDIT The output of route is

Destination      Gateway     Genmask        Flags   Metric Ref  Use Iface
default      192.268.255.1   0.0.0.0        UG       0      0    0   eth0
192.18.255.0     *           255.255.255.0  U        0      0    0   eth0

but I am unable to even ping the gateway

share|improve this question
    
1) can you ping 8.8.8.8 ? 2) what is the output of host google.com ? –  sputnick Feb 25 '13 at 22:11
    
@sputnick Unable to ping 8.8.8.8 and my system does not run host –  mathematician1975 Feb 26 '13 at 9:10
add comment

2 Answers

up vote 3 down vote accepted

/etc/resolv.conf is part of configuration of the DNS client (which is in its simplest form a part of libc), which tells it what servers to ask when resolving a DNS query. If you can live without DNS, i.e. use IP addresses for everything, which includes hardcoding these into /etc/hosts, you won't need it. Once you'll need to resolve a hostname using DNS, you are going to need it.

To set up the connection you need to:

  • bring the device up
  • assign the IP to the device
  • configure routing - create route to gateway, add default route via the gateway.
share|improve this answer
    
Thanks for your answer - what IP addresses do I require in /etc/hosts ? My file only contains localhost –  mathematician1975 Feb 25 '13 at 22:12
    
Only those you'll want to resolve without consulting DNS. On the other hand, if your libc implementation supports it, you can put nameserver IP into /etc/resolv.conf. Just remember you'll get DNS queries when resolving hostnames (which might be unwanted in some embedded situations). –  peterph Feb 26 '13 at 16:08
add comment

/etc/resolv.conf stores DNS server info (nameserver ). Even though You set up static address correctly, Your host my not be properly identified by the network thus all traffic sourcing from Your machine will be lost (unable to route properly).

The above may be a wild guess, but I would check man page for resolv.conf and ask Your IT admin for the DNS info.

share|improve this answer
    
Thanks for the answer - I will try this tomorrow –  mathematician1975 Feb 25 '13 at 22:37
1  
resolv.conf and DNS are not related with routing. –  jlliagre Feb 26 '13 at 0:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.