Fixed IP address problems

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
I've had the Pi working for some time using DHCP on a wired connection  
to my modem/router and connected to a wired dual boot Windows 8/Linux  
Mint desktop. Putty and Ultra VNC both work and I can ping both the IP  
address and the name raspberrypi on both OSs.

So, not being content with this happy state of affairs, I decided to fix  
the Pi's IP address.

I changed the line in /etc/networks/interfaces

from:
iface eth0 inet dhcp

to:
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.254

and rebooted the Pi and the Win8 machine. I can ping 192.168.1.100 but  
not raspberrypi. I noticed that the router had changed raspberrypi to  
192.168.1.100 but it hadn't changed from DHCP to static so I switched it  
off and on again. It now shows static.

Having once again rebooted the Pi and Win8 machine I still can't ping  
raspberrypi. The Pi can access the internet (I can still control it via  
Putty).

I can (and have) gone back to DHCP so everything works, but I'd like to  
fix the little bastard's IP address. I feel that I'm missing something  
simple.

Any suggestions?

Another Dave

Re: Fixed IP address problems
On Tue, 09 Jul 2013 16:52:20 +0100

Quoted text here. Click to load it

I always used to allocate manual addresses on my LAN, but these days if
I want to fix an address I usually do it on the DHCP server by
associating it with the device's MAC address.


Re: Fixed IP address problems
On 09/07/2013 17:04, Rob Morley wrote:
Quoted text here. Click to load it
I'm not sure I understand you. I assume the DHCP server is the  
modem/router but I can't find the facility you refer to in its menus. By  
"address" do you mean the Pi's IP address (192.168.1.100) or its name  
"raspberrypi"? Is the "MAC address" what my router refers to as the  
Physical Address?

Sorry to be a bit slow.

Another Dave




Re: Fixed IP address problems
On Tue, 09 Jul 2013 17:48:52 +0100

Quoted text here. Click to load it
Yes, it's a (supposedly) unique hardware identifier written in the
firmware of every network device by the manufacturer - MAC stands for
Media Access Control.  When a device makes a DHCP request the packet
includes its MAC address, the router checks if that MAC is in its table
of reserved IPs/MACs, and if it is then it sends that IP address back to
the client, along with the other DHCP information.


Re: Fixed IP address problems
On 09/07/2013 17:48, Another Dave wrote:
Quoted text here. Click to load it

Not all of them have it... Some support the concept of static IP, but  
handled by DHCP. So the router remembers the MAC address of the device  
and makes sure it always gives it the specified IP, and also never hands  
out that IP to other devices.




--  
Cheers,

John.

We've slightly trimmed the long signature. Click to see the full one.
Re: Fixed IP address problems
 Another Dave  wrote:

Quoted text here. Click to load it

Try flushing the DNS cache.  Never used Win-8, in previous versions of
Windows the command is "ipconfig /flushdns"
--
Roberto Waltman

[ Please reply to the group,
We've slightly trimmed the long signature. Click to see the full one.
Re: Fixed IP address problems
On 09/07/2013 17:21, Roberto Waltman wrote:
Quoted text here. Click to load it

Thanks for the reply. I tried the command, it seemed to be acceptable to  
Win8 but it didn't fix the problem (even after a re-boot) and it  
wouldn't explain the failure in Linux anyway.

Another Dave



Re: Fixed IP address problems
Quoted text here. Click to load it

This manifests itself that with a static ip address you cannot  
use the dns name any longer, but an IP address works fine. Like
with ssh, ping etc?

In which case you have some kind of DHCP to DNS bridge like dnsmasq
or similar. This bridge picks up the name the DHCP client presents
to the server ("raspberrypi" is the default for our favourite OS)
and the server enters it into it's DNS table for the duration of the
DHCP lease; pointing to the correct IP address.

With static IP addresses there are no longer such an exchange,  
and you must enter the DNS name manually into wherever you configure
your DNS. This may include MAKING a DNS server.

These names typically require a dot, like "raspberrypi.myname.com" or
"raspberrypi.local". See a DNS manual for the details.

Or just leave it to dnsmasq.  

-- mrr

Re: Fixed IP address problems
wrote:

Quoted text here. Click to load it

Of course! (Banging my forehead.)
You need a replacement for the DNS server (1) or, much easier, add
this line to the hosts file in all your systems:

 192.168.1.100    raspberrypi

R.
(1) Search for "dual DHCP DNS server" for a good windows setup
--
Roberto Waltman

[ Please reply to the group,
We've slightly trimmed the long signature. Click to see the full one.
Re: Fixed IP address problems
On 09/07/13 18:08, Morten Reistad wrote:
Quoted text here. Click to load it

Possibly the shortest  way is to ID the MAC of the PI and tell the  
router to assign it a fixed IP address based on its MAC address.

Then it still gets its IP via DHCP and all works, but its on a fixed  
address too.


Quoted text here. Click to load it


--  
Ineptocracy

(in-ep-toc?-ra-cy) ? a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.


Re: Fixed IP address problems

Quoted text here. Click to load it
of
acceptable to


That works if it's always on the same subnet, but what if you wanted to  
sneaker-net it with a back-pocket port to a friends home Ethernet and  
you still want to resolve the domain name as URL? Or if you wanted to  
expose the r.pi directly to the net with a static IP (perhaps in the  
de-militarized zone of your home network (as perhaps a fairly secure and  
inexpensive website server.))  One would want to name the r.pi device  
domain. Then routers pick up and propagate the association in router  
tables.
So, not being content with this happy state of affairs, I decided to fix  

the Pi's IP address.

Quoted text here. Click to load it


domain raspberrypi (which would be an absolutely horrible conflict  
outside your home net, so pick a domain you got from godady if you are  
static IP raw to the internet) Isn't there a line which would set the  
host name?


I have an Axis 200 camera which is a web server, and the name is set on  
the router. First boot the camera with IP address, netmask and gateway  
then use a pc or terminal on the same subnet to manipulate the ARP table  
and associate a name to the IP address. (open CMD, type "arp -?" for  
help, exit to close CMD)
http://disneywizard.angelfire.com/Camera.html I thought I remembered  
setting  a line in the camera's CONFIG file (in FTP - "put config  
CONFIG")

Gee, I thought I was answering the question of domain name assignment,  
and ended up more confused from half remembered domain name assignment  
to equipment from days of yore.

.--  
  All ladders in the Temple of the Forbidden Eye have thirteen steps.
There are thirteen steps to the gallows, firing squad or any execution.
 The first step is denial...                           Don't be  
bamboozled:
       Secrets of the Temple of the Forbidden Eye revealed!
          Indiana Jones? Discovers The Jewel of Power!
         visit ?(o=8> http://disneywizard.com/
<8=o)? visit

Re: Fixed IP address problems
On 09/07/13 16:52, Another Dave wrote:
Quoted text here. Click to load it

Then you have a DNS/host table issue.

Quoted text here. Click to load it

yu need to run your own DNS or edit your hosts file

Quoted text here. Click to load it


--  
Ineptocracy

(in-ep-toc?-ra-cy) ? a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.


Re: Fixed IP address problems
Quoted text here. Click to load it

Your router is probably advertising itself as a DNS resolver and it
maintains a local zone derived from DHCP information.
Once you stop using DHCP your router no longer does that for you, and
it remains working for a short while because of caches and DHCP lease
period.   After that, it fails.

You will need to tell your router about the static mapping from
raspberrypi to 192.168.1.100 or put that mapping in the hosts files
of the other computers.

Re: Fixed IP address problems
On 09/07/2013 16:52, Another Dave wrote:
Quoted text here. Click to load it

One possible solution.  In Windows, system32\drivers\etc, edit the file  
hosts. with Notepad to add the line:

   192.168.1.100  raspberrypi

With my pack of RPi cards I have:

   192.168.0.51    raspi-1
   192.168.0.52    raspi-2
   192.168.0.53    raspi-3

and so forth.  I also like Rob's suggestion of reserving IP addresses  
against MAC addresses in your router.

I found my initial information here:
   http://elinux.org/RPi_Setting_up_a_static_IP_in_Debian

There is also a hosts file in Linux.
--  
Cheers,
David
We've slightly trimmed the long signature. Click to see the full one.
Re: Fixed IP address problems
On 09/07/2013 18:20, David Taylor wrote:
Quoted text here. Click to load it

Bingo!

Many thanks to all who came up with this and other suggestions. I've  
spent quite a while searching for a solution so it's quite a relief.  
Usenet is the best!

None of the guides to fixing the IP address even mention this  
requirement so I'm surprised they got it to work.

Another Dave



Re: Fixed IP address problems
Quoted text here. Click to load it

It is not a requirement, just a convenience.
Most people setting fixed IP probably access the device via that IP.

And also, the support from your router to put DHCP-assigned addresses
into its local DNS resolver is just a luxury, not all routers do that.

Re: Fixed IP address problems
On 09/07/2013 19:54, Rob wrote:
Quoted text here. Click to load it

It's not a convenience or a luxury. If Ultravnc hadn't put  
"raspberrypi:1" up in its address box, I'd have been quite happy typing  
in 190.168.1.100 till kingdom come and I would have saved myself a lot  
of time :-(

Another Dave


Re: Fixed IP address problems
On 09/07/2013 20:14, Another Dave wrote:
Quoted text here. Click to load it

One last thing to check if you have not done so already, it to make sure  
the address you have allocated is not inside the range of addresses that  
the router is allowed to used for DHCP -else its possible to get an  
address conflict.


--  
Cheers,

John.

We've slightly trimmed the long signature. Click to see the full one.
Re: Fixed IP address problems
On 10/07/2013 14:29, John Rumm wrote:
Quoted text here. Click to load it

Thanks. I was aware of this and while I was searching the router's  
options for doing it I noticed an inconspicuous check box: "Always give  
same address to DHCP Clients".
This seems to answer my prayers; DHCP, DNS and fixed IP address. Now all  
I have to do is get the router to save my changes, which it refuses to  
do although I have Administrator privileges.

Another Dave



Re: Fixed IP address problems
On Thu, 11 Jul 2013 08:56:03 +0100, Another Dave wrote:

Quoted text here. Click to load it

Statically allocated not fixed IP address, subtle but important
distiction.

If the DHCP server is down the device won't get an IP address when it
powers up, it *might* assume the last one it had is OK to use
provided the lease (if it's remembered that as well) is still valid.

With a fixed IP address the device will power up and use that IP
address regardless of the state of the DHCP server.  

With the former the machine may or may not be accessable via it's
static IP address, with the latter it will be.

--  
Cheers
Dave.




Site Timeline