Fargo
Posts: 18
Joined: Mon Mar 14, 2016 10:40 pm

Raspberry Pi 3 Wifi Static IP

Mon Aug 15, 2016 4:46 pm

So I have been trying to setup a static IP for the Pi but all the tutorials I find online talking about this seem to reffer to the Ethernet port. I have a RPi 3 so I use the Wifi feature, so is the process to put the IP static the same or is it different?

Thanks for any help in advance! :)

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Raspberry Pi 3 Wifi Static IP

Mon Aug 15, 2016 4:54 pm

You set the static IP address in the "/etc/dhcpcd.conf" file.

This is a snippet from the dhcpcd.conf for one of my Pi's. It sets a static IP of "192.168.0.11" for the wireless and a static IP of "192.168.0.10" for ethernet

Code: Select all

interface wlan0
inform 192.168.0.11
static routers=192.168.0.1
static domain_name_servers=8.8.8.8 8.8.4.4

interface eth0
inform 192.168.0.10
static domain_name_servers=8.8.8.8 8.8.4.4
static routers=192.168.0.1

Fargo
Posts: 18
Joined: Mon Mar 14, 2016 10:40 pm

Re: Raspberry Pi 3 Wifi Static IP

Mon Aug 15, 2016 5:01 pm

So I should set it on the dhcpcd.conf ?
Ok thanks

User avatar
nl3prc
Posts: 160
Joined: Sun Jul 24, 2016 12:39 pm
Location: Den Helder the netherlands

Re: Raspberry Pi 3 Wifi Static IP

Mon Aug 15, 2016 5:09 pm

In a lot of cases you can set a static IP in your router by telling the router to link a specific IP number to the Mac number of your Ethernet card

Fargo
Posts: 18
Joined: Mon Mar 14, 2016 10:40 pm

Re: Raspberry Pi 3 Wifi Static IP

Mon Aug 15, 2016 5:12 pm

nl3prc wrote:In a lot of cases you can set a static IP in your router by telling the router to link a specific IP number to the Mac number of your Ethernet card
But I'm using a Ethernet cable there, wouldnt I just end up configuring it for the Ethernet connection.

Fargo
Posts: 18
Joined: Mon Mar 14, 2016 10:40 pm

Re: Raspberry Pi 3 Wifi Static IP

Mon Aug 15, 2016 5:14 pm

JimmyN wrote:You set the static IP address in the "/etc/dhcpcd.conf" file.

This is a snippet from the dhcpcd.conf for one of my Pi's. It sets a static IP of "192.168.0.11" for the wireless and a static IP of "192.168.0.10" for ethernet

Code: Select all

interface wlan0
inform 192.168.0.11
static routers=192.168.0.1
static domain_name_servers=8.8.8.8 8.8.4.4

interface eth0
inform 192.168.0.10
static domain_name_servers=8.8.8.8 8.8.4.4
static routers=192.168.0.1
Could you please send me a post or a tutorial that explains me this more detailed? I'm kind of confused about what I'm supposed to do there.

User avatar
nl3prc
Posts: 160
Joined: Sun Jul 24, 2016 12:39 pm
Location: Den Helder the netherlands

Re: Raspberry Pi 3 Wifi Static IP

Mon Aug 15, 2016 6:58 pm

Fargo wrote:
nl3prc wrote:In a lot of cases you can set a static IP in your router by telling the router to link a specific IP number to the Mac number of your Ethernet card
But I'm using a Ethernet cable there, wouldnt I just end up configuring it for the Ethernet connection.
wel then you have to setup your router anyway so that the ip's that are static are out of the range of your routers dhcp server other wise it wil never work

i always use my mac adress from my ehternet card to set the ip on the router

Cable ore WiFi that is not importend

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Raspberry Pi 3 Wifi Static IP

Mon Aug 15, 2016 7:08 pm

Edit the dhcpcd.conf using

Code: Select all

sudo nano /etc/dhcpcd.conf
Scroll down to the bottom of the file and add the lines for wlan0, or eth0, or both.

First line "interface eth0" specifies the interface
Second line "inform 192.168.0.10" sets a static IP for eth0
Third line "static domain_name_servers=8.8.8.8 8.8.4.4 set the DNS server to Google's DNS
Fourth line "static routers=192.168.0.1" sets the gateway to the internet (your routers address). You could also use that same address for your "domain_name_servers=" if you wanted to use your ISP's nameserver rather than Google's.

Note that if you've edited the "/etc/network/interfaces" file to set a static IP you'll need to return that to it's initial configuration, or you may get two IP addresses, one static and one provided by DHCP.

User avatar
nl3prc
Posts: 160
Joined: Sun Jul 24, 2016 12:39 pm
Location: Den Helder the netherlands

Re: Raspberry Pi 3 Wifi Static IP

Mon Aug 15, 2016 8:00 pm

that's quite difficult i find that doing it in router with your mac adress much easier then reconfiguring your linux

canellas
Posts: 8
Joined: Thu Aug 25, 2016 7:48 pm

Re: Raspberry Pi 3 Wifi Static IP

Tue Oct 25, 2016 6:21 pm

Hi!

What if I need to define a netmask, say, 255.255.248.0?

Thanks!

canellas
Posts: 8
Joined: Thu Aug 25, 2016 7:48 pm

Re: Raspberry Pi 3 Wifi Static IP

Tue Oct 25, 2016 6:22 pm

Hi!

What if I need to define a netmask, say, 255.255.248.0?

Thanks!

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

Re: Raspberry Pi 3 Wifi Static IP

Tue Oct 25, 2016 7:07 pm

I don't use "inform". I use "static ip_address" and it works, however I believe both take the address in CIDR notation, so for 192.168.0.10 with a netmask of 255.255.240.0 (20 bits) you'd use 192.168.0.10/20 as the IP address and that will specify the netmask as well.

castletonroad
Posts: 63
Joined: Sat Jul 25, 2015 11:23 pm

Re: Raspberry Pi 3 Wifi Static IP

Tue Oct 25, 2016 9:30 pm

My configuration:

The wlan adaptor (wlan0) part to insert in /etc/network/interfaces:

Code: Select all

iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan0 << my WiFi adaptor is a removable dongle
iface default inet static
 address 192.168.1.21 << your static IP address
 netmask 255.255.255.0 << your subnet address
/etc/wpa_supplicant/wpa_supplicant.conf:

Code: Select all

country=AU
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="yourSSID"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk="yourPASSPHRASE"
And on your router (for good measure), make your IP static using the MAC address.
Raspberry Pi 3 Model B | Raspberry Pi 2 Model B

klricks
Posts: 6365
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Raspberry Pi 3 Wifi Static IP

Tue Oct 25, 2016 9:45 pm

Fargo wrote:
nl3prc wrote:In a lot of cases you can set a static IP in your router by telling the router to link a specific IP number to the Mac number of your Ethernet card
But I'm using a Ethernet cable there, wouldnt I just end up configuring it for the Ethernet connection.
You would assign an IP to the Ethernet MAC and a different IP to the WIFI MAC. Then make no changes to the RPi... Leave the RPi set for DHCP.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

domeninini
Posts: 1
Joined: Sun May 20, 2018 2:49 pm

Re: Raspberry Pi 3 Wifi Static IP

Mon May 21, 2018 8:52 pm

I tried it as described above. get the error code „falles to start dhcpcd on all interfaces.“ What die I wrong ?

Return to “Beginners”