pattere
Posts: 3
Joined: Tue Mar 11, 2014 4:29 pm

Raspian Jessie Static IP issue

Mon May 09, 2016 8:59 pm

I have been searching, and cannot find this issue.

I have attempted to set the /etc/dhcpcd.conf file for a static ip. I can get the ip and mask to report correctly when running an ifconfig; but, the gateway reports incorrectly.

When running the ifconfig, I receive:
inet addr: 10.10.12.15
Bcast: 10.10.**.255 -- This should be 10.10.**.254
Mask: 255.255.255.0

The section of the dhcpcd.conf I edited to set the ip address:
# Set static ip address
iface eth0
static ip_address=10.10.**.15/24
static routers=255.255.255.0
static domain_name=10.10.**.254
static domain_name_servers=10.10.**.*** 10.10.**.**

I am able to ping my gateway from the Rpi, and addresases on the same subnet. But, I cannot ping machines on other subnets, or get to the outside world. What do I need to do to get the gateway to report/function correctly on the pi?

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Raspian Jessie Static IP issue

Mon May 09, 2016 9:18 pm

You're putting the mask as the router, that will never work.

Code: Select all

interface eth0
static ip_address=10.10.12.15/24
static routers=10.10.12.rrr
static domain_name_servers=10.10.12.yyy 10.10.12.zzz
#
interface wlan0
static ip_address=10.10.12.www
static routers=10.10.12.rrrr
static domain_name_servers=10.10.12.yyy 10.10.12.zzz
Where .eee is your RPi's static address for eth0
.www is your RPi's static address for wlan0
/24 is a shorthand for for 255.255.255.0 (24 bits are 1, 8 bits are 0)
.rrr is your home router's address
.yyy is your DNS #1
.zzz is your DNS #2

/24 is the more logical CIDR format for IPv4 network masks.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Raspian Jessie Static IP issue

Mon May 09, 2016 9:23 pm

So you've subnetted 10/8, that's a choice.
I think you want to use this...
Network 10.10.12.0
Address 10.10.12.15
Broadcast 10.10.12.255
Netmask 255.255.255.0
DNS 10.10.12.254
... unless your subnet isn't 10.10.12.0/24

I don't think there is an option such as "domain_name=<IP quad>" in dhcpcd, but I'm not used to this software.

You can use a tool like ipcalc to stop guessing and start using the right values, even for cryptic subnets. I like this one: http://jodies.de/ipcalc (ipcalc is also a debian package if you want to run it locally.)

(BTW, obfuscating private LAN adresses borders on useless -you're protected by your firewall- and makes reading difficult.)

EDIT: The DNS address is my guess. I see you have 2 DNS servers inside your LAN? Normally one is enough, especially if it's colocated with your gateway. If it's down, you're done anyway...
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

pattere
Posts: 3
Joined: Tue Mar 11, 2014 4:29 pm

Re: Raspian Jessie Static IP issue

Tue May 10, 2016 9:01 pm

Thanks for the replies.

When searching further, I have found that I should only need to set:

/etc/dhcpcd.conf
interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8

***This is just an example from: https://wiki.archlinux.org/index.php/dh ... ic_profile***

So, my question is... Is the static routers supposed to be my gateway? And, if so, why does the setting of 10.10.**.254 report as Bcast 10.10.**.255?
Or, am I completely off base in the way I am trying to set the gateway?

KCarscadden
Posts: 56
Joined: Sat Jun 09, 2012 9:00 pm
Location: Canada

Re: Raspian Jessie Static IP issue

Tue May 10, 2016 11:38 pm

Probably the answers to your questions are here:

http://www.jeffgeerling.com/blog/2016/s ... spberry-pi


Keith

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Raspian Jessie Static IP issue

Wed May 11, 2016 12:31 pm

pattere wrote:So, my question is... Is the static routers supposed to be my gateway?
Yes. A router is just another name for a gateway, basically.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Raspian Jessie Static IP issue

Wed May 11, 2016 2:51 pm

pattere wrote: So, my question is... Is the static routers supposed to be my gateway? And, if so, why does the setting of 10.10.**.254 report as Bcast 10.10.**.255?
It will report the Bcast (Broadcast) address as 10.10.**.255, because that is the Broadcast address. The Broadcast address is not the router/gateway address.

The Broadcast address is the last address in the network and shouldn't be assigned to anything. It's used by certain things as a way to sending data to all hosts (there's also the "network number" .0 in a /24 network that does something similar).

Return to “Beginners”