Jswee1
Posts: 22
Joined: Tue Dec 15, 2015 2:25 am

IP Config Static IP Setup

Thu Jan 21, 2016 3:36 am

Ive recently setup a static ip addresses on all of my devices but im having some problems with the pi cause i want to shut off dhcp on my router i have gone to

Code: Select all

cat /etc/network/interfaces
and

Code: Select all

ifconfig
and continued it works fine when dhcp is on on my router but when i shut it off it doesnt work and all of my other devices connect fine

User avatar
procount
Posts: 2058
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: IP Config Static IP Setup

Thu Jan 21, 2016 10:09 am

Are you running Wheezy or Jessie on the RPi?
How have you set up your static IP address? Please post what you added to the config files (e.g interfaces or dhcpcd.conf) to set this up (excluding any sensitive info like usernames/passwords/ssids!)
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

Jswee1
Posts: 22
Joined: Tue Dec 15, 2015 2:25 am

Re: IP Config Static IP Setup

Thu Jan 21, 2016 12:40 pm

Wheezy heres the output of ifconfig

Code: Select all

eth0      Link encap:Ethernet  HWaddr b8:27:eb:cc:6a:47
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:499 errors:0 dropped:0 overruns:0 frame:0
          TX packets:247 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:32876 (32.1 KiB)  TX bytes:36064 (35.2 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:580 (580.0 B)  TX bytes:580 (580.0 B)
and output of route -n

Code: Select all

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    202    0        0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0
and current network settings

Code: Select all

auto lo eth0 wlan0 wlan1
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1


iface wlan0 inet manual

iface wlan1 inet manual


It works when dhcp on my router is on but when its off it wont

User avatar
procount
Posts: 2058
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: IP Config Static IP Setup

Thu Jan 21, 2016 1:14 pm

Can you ping your router?

Code: Select all

ping 192.168.0.1
If you ping an external URL, does it get converted to an IP address?

Code: Select all

 $ ping www.google.com
PING www.google.com (216.58.208.196) 56(84) bytes of data.
Have you setup a DNS server address?
If not edit /etc/resolv.conf and add a "server" entry to the file:-

Code: Select all

server 8.8.8.8
(or replace 8.8.8.8 with your usual DNS address)
Then reboot or restart networking.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

User avatar
NormanDunbar
Posts: 111
Joined: Wed Nov 23, 2011 12:13 pm
Location: Leeds, West Yorkshire, England.
Contact: Website

Re: IP Config Static IP Setup

Thu Jan 21, 2016 1:25 pm

Editing resolv.conf is ok, as long as the "resolveconf" package is not installed. As that will overwrite your carefully edited /etc/resolv.conf file.

To find out, this might help:

Code: Select all

dpkg -l | grep resolvconf
If that utility is present, you need to add the dns details to /etc/interfaces as follows:

Code: Select all

dns-nameservers   8.8.8.8
dns-nameservers   8.8.4.4
If, and when, you upgrade to Jessie, networking will change. I've put up a blog post at http://qdosmsq.dunbar-it.co.uk/blog/201 ... ifi-setup/ which outlines the various steps you might need to follow to get networking running under Jessie. It might be useful.


HTH

Cheers,
Norm.
Why do they put lightning conductors on churches?
Why did Tarzan never have a beard?

User avatar
procount
Posts: 2058
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: IP Config Static IP Setup

Thu Jan 21, 2016 2:22 pm

@norman - thanks for expanding on my dns attempts. Your Jessie networking post looks very useful (and I liked reading about your HP ink exploits!) :D
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

Jswee1
Posts: 22
Joined: Tue Dec 15, 2015 2:25 am

Re: IP Config Static IP Setup

Thu Jan 21, 2016 7:25 pm

Well it doesnt seem to be working at all i have webmin installed does that effect it or samba

User avatar
NormanDunbar
Posts: 111
Joined: Wed Nov 23, 2011 12:13 pm
Location: Leeds, West Yorkshire, England.
Contact: Website

Re: IP Config Static IP Setup

Thu Jan 21, 2016 7:47 pm

NormanDunbar wrote:... you need to add the dns details to /etc/interfaces as follows:

Code: Select all

dns-nameservers   8.8.8.8
dns-nameservers   8.8.4.4
When I said that I should have said that it should go beneath the "iface..." line in your interfaces file.

Also, it should possibly be indented by one TAB character, according to the Pi User Manual.

Code: Select all

allow-hotplug eth0
iface eth0 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    dns-nameservers 8.8.8.8
    dns-nameservers 8.8.4.4
That's how I used to do it on Wheezy in the past, and it worked for me.

And finally, I'm pretty sure you only need address, netmask and gateway.


Your resolve.conf file should end up looking like this:

Code: Select all

nameserver 8.8.8.8
nameserver 8.8.4.4
Either by manual editing (the dpkg -l command above doesn't show that resolvconf is installed) or by the resolvconf utility "editing" it for you.

HTH


Cheers,
Norm.
Why do they put lightning conductors on churches?
Why did Tarzan never have a beard?

Return to “Networking and servers”