amaurer
Posts: 6
Joined: Thu Aug 22, 2013 8:17 pm

Static IP not connecting

Thu Aug 22, 2013 8:31 pm

Hi. I have the following problem, I hope someone can help me.
Some days ago I was able to define a static IP to my Raspberry by editing /etc/network/interfaces, but now, if I put DHCP I can log in and the RPI can "see" the Internet, but if I configure a static IP, the LAN can see the RPI, means I can log in from web browser and my devices in the LAN do register in the RPI, but the router cannot "see" the RPI, so no Internet acces is availiable.

I am running Incredible Pi 2.11.

What I'm putting into %etc/network/interfaces is:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.222
netmask 255.255.255.0
gateway 192.168.1.1

The strange thing is that I am doing exactly the same thing I did the first time. I have even re flashed the SD card from scratch using the same image I used the first time but now it is not working.

Can someone give a hint on what I'm doing wrong ?

Thanks
Andres

plugwash
Forum Moderator
Forum Moderator
Posts: 3439
Joined: Wed Dec 28, 2011 11:45 pm

Re: Static IP not connecting

Thu Aug 22, 2013 8:46 pm

Are you sure the gateway address is correct?

itimpi
Posts: 1088
Joined: Sun Sep 25, 2011 11:44 am
Location: Potters Bar, United Kingdom
Contact: Website

Re: Static IP not connecting

Thu Aug 22, 2013 8:56 pm

When you say you cannot access the Internet, are you sure this is the case? I am wondering if your problem is that you do not have a DNS (name server) defined so that Internet names cannot be resolved to IP addresses. With DHCP this would be set by the router - with a static IP you need to set it manually.

If your router supports reserving fixed IP addresses for a given MAC address, then this is the best way forward as that means the Pi can be left set to DHCP and the router supplies the DNS. If not then you should either set your router iP as the DNS or use something like 8.8.8.8 (a google DNS)

User avatar
tonyhughes
Posts: 951
Joined: Wed Dec 26, 2012 3:46 am

Re: Static IP not connecting

Thu Aug 22, 2013 9:34 pm

amaurer wrote://snip//
What I'm putting into %etc/network/interfaces is:
//snip//
Can someone give a hint on what I'm doing wrong ?
//snip//
Not to be pedantic, but if your post is correct, then it's likely the problem.... "%etc/network/interfaces" is not a valid filename.

Also check other basic things like:

Is your ethernet cable functioning properly (swap it out)
Is your router port functioning properly (try another port)
Is everything plugged in nicely'
Have you added new hardware to Pi USB causing power problems (unplug USB devices)
Has your PSU had a moo-moo (try a new PSU)

amaurer
Posts: 6
Joined: Thu Aug 22, 2013 8:17 pm

Re: Static IP not connecting

Thu Aug 22, 2013 10:26 pm

Thanks all for your answers. I' answer all of your concerns.

Yes, the gateway IP is correct.

I'm sorry I made a mistake in the post. Of course the file path is /etc/network/interfaces. I am able to edit the file.

It is not a hardware problem or a misconnection, since I can access the RPI from my web browser into the IP I asigned.

It should be the DNS problem itimpi addresses, but how do I set a DNS in RPI ?

Thanks

User avatar
rpdom
Posts: 15005
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Static IP not connecting

Fri Aug 23, 2013 6:38 am

amaurer wrote:how do I set a DNS in RPI ?
DNS server addresses are held in /etc/resolv.conf

Sometimes they get put there automatically, sometimes you need to do it manually. It depends what software is installed.
Have a look at that file and see what, if anything, is in it - especially any lines that start with "nameserver"

If it is blank, or doesn't have any nameserver lines, try adding this one:

Code: Select all

nameserver 8.8.8.8
and see if that fixes your problem. No reboot required - it should just start working.

Test it with

Code: Select all

ping -c 4 google.com
You should get 4 successful packets.

amaurer
Posts: 6
Joined: Thu Aug 22, 2013 8:17 pm

Re: Static IP not connecting

Fri Aug 23, 2013 12:53 pm

Hi. Thank you for your answer.
The situation is like this:
the file resolv.conf I have 2 nameserver entries, 8.8.8.8 and 8.8.4.4
when I use DHCP I do get an IP from my router and can get to Internet, but when using static IP the router doesn't show any IP asigned to the RPI. The RPI does get the static IP since I can connect to it via a web browser but cannot get out to Internet.
Would you say it's a router problem ?

W. H. Heydt
Posts: 10768
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Static IP not connecting

Fri Aug 23, 2013 7:51 pm

If the initial post is correct, the interfaces file is missing two lines:

network 192.168.1.0
broadcast 192.168.1.255

I doubt the system is loading the static IP at all, since it lacks vital information. There is probably something in the system log messages.

User avatar
rpdom
Posts: 15005
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Static IP not connecting

Fri Aug 23, 2013 8:14 pm

W. H. Heydt wrote:If the initial post is correct, the interfaces file is missing two lines:

network 192.168.1.0
broadcast 192.168.1.255

I doubt the system is loading the static IP at all, since it lacks vital information. There is probably something in the system log messages.
No, those lines haven't been needed for years now. As long as the "address" and "netmask" lines are present and correct, the "network" and "broadcast" are automatically calculated from those.

amaurer
Posts: 6
Joined: Thu Aug 22, 2013 8:17 pm

Re: Static IP not connecting

Wed Aug 28, 2013 12:57 pm

Hi. Here is an update.
I suspected something was wrong with my router's config, so I installed Freepbx over CentOS in a desktop pc and ran it with DHCP and also with static IP and everithing went well, so it is not a router issue.
Do you have any new ideas on how to solve my problem ?
Some time ago the static IP worked well and I don't remember doing anything to modify its behaviour.

Thanks again

Return to “General discussion”