valakaushal
Posts: 5
Joined: Thu Mar 10, 2016 8:07 am

IP address issue in pi 2 model

Thu Mar 10, 2016 9:11 am

Hey,

I have purchased pi 2 board.
Now i want to assign one static ip address to my board.
I have used
$sudo nano /etc/network/interfaces
and then i have inserted my IP address, gateway and subnet mask.
I have also edited resolv.conf file to nameserver 8.8.8.8

and then i reboot my board.

After reboot, i used ifconfig command to see the ip address
Problem is even though after doing all this steps, my board has by default ip address (i.e 169.269.227.193)

DirkS
Posts: 10194
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: IP address issue in pi 2 model

Thu Mar 10, 2016 9:24 am

What changes did you make?
Are you running Jessie or Wheezy?
On Jessie you set a static address in /etc/dhcpcd.comf

valakaushal
Posts: 5
Joined: Thu Mar 10, 2016 8:07 am

Re: IP address issue in pi 2 model

Thu Mar 10, 2016 10:51 am

I am using Jessie.
And i did following changes by typing following command
$sudo nano /etc/network/interfaces


iface lo inet loopback
iface eth0 inet static

address 172.16.0.29
netmask 255.255.240.0
gateway 172.16.0.1


i have done this changes to interfaces file.
i also made changes by typing

$sudo nano /etc/resolv.conf

nameserver 8.8.8.8

I made these two changes and then reboot my board.

DirkS
Posts: 10194
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: IP address issue in pi 2 model

Thu Mar 10, 2016 11:11 am

See my above comment about using dhcpcd.conf on Raspbian Jessie.
There s actually a comment at the top of /etc/network/interfaces about this.

valakaushal
Posts: 5
Joined: Thu Mar 10, 2016 8:07 am

Re: IP address issue in pi 2 model

Fri Mar 11, 2016 4:03 am

DirkS wrote:See my above comment about using dhcpcd.conf on Raspbian Jessie.
There s actually a comment at the top of /etc/network/interfaces about this.
Dear Driks
Please tell me exactly what changes are to be done in /etc/dhcpcd.conf file

valakaushal
Posts: 5
Joined: Thu Mar 10, 2016 8:07 am

Re: IP address issue in pi 2 model

Fri Mar 11, 2016 4:12 am

One more thing is, my pi board by default take IP address of 169.254.227.193.

Candyjet
Posts: 56
Joined: Sun Jan 10, 2016 3:45 pm

Re: IP address issue in pi 2 model

Fri Mar 11, 2016 9:23 am

V, I was also struggling with this. I succeeded following these instructions.
http://www.circuitbasics.com/how-to-set ... pberry-pi/
CJ

DirkS
Posts: 10194
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: IP address issue in pi 2 model

Fri Mar 11, 2016 9:40 am

valakaushal wrote:One more thing is, my pi board by default take IP address of 169.254.227.193.
That is a default / fallback address in case it cannot get a DHCP or static address.

Regarding the changes:
* get /etc/network/interfaces back to it's original state.

Code: Select all

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
* At the end of /etc/dhcpcd.conf add

Code: Select all

interface eth0
static ip_address=172.16.0.29/20
static routers=172.16.0.1
static domain_name_servers=8.8.8.8

valakaushal
Posts: 5
Joined: Thu Mar 10, 2016 8:07 am

Re: IP address issue in pi 2 model

Sat Mar 12, 2016 9:42 am

Hey guys,
Raspbian wheezy has solved my problem.
:)

DirkS
Posts: 10194
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: IP address issue in pi 2 model

Sat Mar 12, 2016 10:05 am

valakaushal wrote:Hey guys,
Raspbian wheezy has solved my problem.
:)
That's very nice of Wheezy.
But I don't think going back to an older version of an OS is a solution...

Return to “Networking and servers”