NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
TerryJColes
Jun 29, 2020Luminary
Using a Static IP Address on a Raspberry Pi Connected to my Nighthawk Router
Hi, I have a couple of Raspberry Pis connected to my Home Network which is provided by my Netgear Router. Ideally I want to set up a static IP Address for each of these Pis, but I cannot make th...
- Jun 30, 2020
schumaku wrote:So t the end of the day, what went wrong and broke the Pi <-> D7800 connection and the Internet connection finally?
The router was unaware of the presence of the Webserver, so didn't route Google traffic when I was trying to use the Static IP.
labatt
Jun 29, 2020Mentor
Configure the Raspberry Pi staticly. That means going into the Pi and assigning an IP address, mask and gateway. Make sure the IP address is outside of the DHCP scope on the router to get things to work. I have 2 Pi's setup this way. One is running Pi-Hole.
If you need help with the assigning, Google is your friend. Lots of Pi info there.
- TerryJColesJun 29, 2020Luminary
'Configure the Raspberry Pi staticly. That means going into the Pi and assigning an IP address, mask and gateway. '
I have been configuring the IP address statically, eg:
# Static IP configuration: interface eth1 static ip_address=192.168.1.98/24 static routers=192.168.1.1 static domain_name_servers=8.8.8.8 metric 200
What do you mean by 'mask and gateway' in this context?
- labattJun 29, 2020Mentor
TerryJColes wrote:'Configure the Raspberry Pi staticly. That means going into the Pi and assigning an IP address, mask and gateway. '
I have been configuring the IP address statically, eg:
# Static IP configuration: interface eth1 static ip_address=192.168.1.98/24 static routers=192.168.1.1 static domain_name_servers=8.8.8.8 metric 200
What do you mean by 'mask and gateway' in this context?
I suspect when you did the actual configuration on the Pi you were asked mask. That does not show when doing the command you gave.
Normally when doing the actual assignment there is a mask question. Is the .98 address within your DHCP scope? If so that can cause issues.
Can you ping the Pi? If not then that would be where to start assuming the .98 is outside of the DHCP scope.
If you do a ifconfig eth1 you should see the mask. Here is output on my Pi.
ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.220 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::1683:1051:7637:eeeb prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:57:7d:03 txqueuelen 1000 (Ethernet)
RX packets 1561476 bytes 193229943 (184.2 MiB)
RX errors 0 dropped 1 overruns 0 frame 0
TX packets 961779 bytes 114655160 (109.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0- antinodeJun 29, 2020Guru
> I have a couple of Raspberry Pis [...]
Model? Network interfaces? Raspbian?
> [...] I want to set up a static IP Address for each of these Pis,
> [...]Why?
Terminology: A "static" address is configured on the device itself.
What you configure on a (DHCP server on a) router is a reserved dynamic
address, not a static address. Which do you mean?Do you really care which way you get a fixed address? Using static
addresses requires more care in the configuration of the DHCP server.(See below.)
> [...] This works, but it means that I can only have the IP Address
> that the Router gave me through DHCP before I reserved it. [...]It _does_? How did you arrive at that conclusion?
> [...] What I really want is to specify static IP Addresses in the
> 'dhcpcd.conf' file on the Pis and have the Router accept these as the
> addresses to use.Is that what you "really want", or is it what you believe is the only
way to get what you _really_ "really want", namely free choice of fixed
IP configuration for these gizmos? Don't choose the solution before you
define the problem.> Also. If I reserve the DHCP Server on the Router gave me, I'm sure I
> used to be able to edit this to the IP Address that I want but this also
> causes the system to fail. [...]Huh? "reserve the DHCP Server"? Does that mess make sense to you
when you read it?If you do enough playing with address reservations, then you might
need to shut down the router (DHCP server) and all the client devices,
and then restart everyone to get everyone into a consistent condition.
> Configure the Raspberry Pi staticly. [...]I typically wouldn't. I usually don't. I usually use address
reservation for mine (Zero W, 3 B+), and it works just fine (on a
D7000[v1], V1.0.1.78_1.0.1).But, if you want to specify odd-ball parameters, like, say, a DNS
server other than the router, then DHCP from the router would not do
what you want.
> What do you mean by 'mask and gateway' in this context?The "subnet mask" is specified by your "/24". "/24" is equivalent to
"255.255.255.0" (that is, 24 binary ones). (And it's more compact.)
"ifconfig" uses the old (bulky) notation in its reports."[default] gateway" and "default router" are equivalent.
If you decide to use static addresses, then you should shrink the
DHCP pool on your router (DHCP server) from its default range,
".2" - ".254", to something smaller, like, say, ".100" - ".254". Then
use the available non-pool addresses (".2" - ".99") as your static
addreses. That way, you don't need to worry about the DHCP server
granting your static addresses to some DHCP clients.Around here, on an R-Pi Zero W (so the network interface is "wlan0"),
I set the following in "/etc/dhcpcd.conf":interface wlan0
static ip_address=10.0.0.150/24
static routers=10.0.0.1
static domain_name_servers=10.0.0.140(I wouldn't bet that setting "static domain_name_servers" there has any
effect on name resolution. "/etc/resolvconf.conf" might have more
influence over that than anything in "/etc/dhcpcd.conf".)My subnet is different ("10.0.0.*" rather than "192.168.1.*"), but
otherwise we seem to be doing similar things. Mine works:pi@rpizw:~$ ping -c 1 dns.google
PING dns.google (8.8.8.8) 56(84) bytes of data.
64 bytes from dns.google (8.8.8.8): icmp_seq=1 ttl=118 time=67.7 ms--- dns.google ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0msrtt min/avg/max/mdev = 67.708/67.708/67.708/0.000 ms
> Model: D7800|Nighthawk X4S - AC2600 WiFi VDSL/ADSL Modem RouterIs that accurate? Wouldn't a D7800 default to "192.168.0.*", not
"192.168.1.*"? Are you just configuring the R-Pi on a wrong subnet?