mattomatto
Posts: 17
Joined: Wed Jul 04, 2012 7:55 pm

Static IP issues

Wed Jul 04, 2012 8:29 pm

Hi there,

My router is on 192.168.1.1

I changed my pi ip from dhcp to static in /etc/network interfaces

The problem is that if I give it the IP 192.168.2.2, I can ping it from another machine but I can't ping my router from the pi.

If I give it an address on 192.168.1.x I get "Connect: Network unreachable" when I try to ping.

Any ideas?

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

Re: Static IP issues

Wed Jul 04, 2012 10:07 pm

IF you're using the most common subnet mask in your router--255.255.255.0--then the 192.168.2.2 isn't in the same subnet as the rest of your machines. You really do need to use 192.168.1.x, for some x that doesn't conflict with any other device on your LAN. The easiest way to do that is to use an IP address that is outside the DHCP range for your router (typically 192.168.1.2 to 50 or 100, or 100 up. It's the last octet you need to look at).

To give an example... My subnet is 192.168.1.x and my Pi is on 192.168.1.121. It works just fine.

mattomatto
Posts: 17
Joined: Wed Jul 04, 2012 7:55 pm

Re: Static IP issues

Wed Jul 04, 2012 10:37 pm

Thanks for the reply.

I have tried setting the IP as follows:

iface eth0 inet static
address 192.168.1.121
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

After a reboot I try pinging anything on my network and I get "destination unreachable"


:(

dktucson
Posts: 36
Joined: Tue Jun 12, 2012 2:57 am

Re: Static IP issues

Wed Jul 04, 2012 11:57 pm

if you ping a known address like "ping www.raspberrypi.org" does it resolve to an address ? it should resolve to 93.93.128.176. Can you hit a website in midori?

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Static IP issues

Thu Jul 05, 2012 12:29 am

Are you in lxde or running from bash? I've heard about various issues with network within lxde
Dear forum: Play nice ;-)

Bakul Shah
Posts: 322
Joined: Sun Sep 25, 2011 1:25 am

Re: Static IP issues

Thu Jul 05, 2012 12:42 am

mattomatto wrote:Hi there,

My router is on 192.168.1.1

I changed my pi ip from dhcp to static in /etc/network interfaces

The problem is that if I give it the IP 192.168.2.2, I can ping it from another machine but I can't ping my router from the pi.

If I give it an address on 192.168.1.x I get "Connect: Network unreachable" when I try to ping.

Any ideas?
Check the ip address, netmask & gateway of the other machine. Can you reach the "router" from this other machine? You can use a netmask of 255.255.0.0 but you may wish to check your network. With 192.168.x.x generally you'd use a netmask of 255.255.255.0 so this smells like misconfiguration.

wh1p
Posts: 29
Joined: Tue Jul 03, 2012 11:00 pm
Location: South East UK
Contact: Website

Re: Static IP issues

Thu Jul 05, 2012 12:43 am

Hey there, you are setting a static IP address on the machine itself but is your router actually understanding that it needs to change the ip address of where it is routing the traffic, because i have seen problems with a few routers where the router is issuing ip addresses via dhcp but when you set a static ip address on the machine it does change the ip on the router associated to the mac address of the network card connecting to the networking causing this problem.

If you could log into your router and see if there are any problems with the static ip address not renewing the details on the router linking the new ip address to the mac address in use.

Please post back on your results of checking your router?

mattomatto
Posts: 17
Joined: Wed Jul 04, 2012 7:55 pm

Re: Static IP issues

Thu Jul 05, 2012 9:04 am

If I try to ping a website, I get unknown host.
My other machines on the network see the router fine, but not the pi.
I'm using the command line, but it doesn't work in lxde either.

I'm not sure what problems I would be looking for in the router... there are no IP addresses reserved and the LAN config is as normal.

Cheers

User avatar
Burngate
Posts: 6253
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Static IP issues

Thu Jul 05, 2012 10:55 am

You said on the other thread that DHCP gave it 192.168.2.2 and things worked.
You really need to find out (and let us know)
(a) the address and netmask of the router
(b) ditto of the machine from which you pinged the pi
(c) ditto of any other machines on the network
Also tell us the address and netmask that DHCP gave it, and the ones you have tried for static IP

Return to “Troubleshooting”