3

I would like to connect my pc and my raspbian through a network without internet output.

I have a router with the dhcp disabled, and I connect to this router my raspberry pi 2 and my pc. The pc picks good the interfaces configuration, but raspberry pi is doing weird things.

eth0      Link encap:Ethernet  HWaddr b8:27:eb:91:1d:60  
          inet addr:169.254.252.195  Bcast:169.254.255.255  Mask:255.255.0.0
          inet6 addr: fe80::a05c:8c24:cad8:6a3f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2280 (2.2 KiB)  TX bytes:50845 (49.6 KiB)

This is the configuration of the interface eth0. I have this in my /etc/network/interfaces

allow-hotplug eth0
iface eth0 inet static
        address 192.168.3.10
        netmask 255.255.255.0

The ip of the router is 192.168.3.1, and netmask is 255.255.255.0. What I'm doing wrong?

Ismael Moral
  • 197
  • 2
  • 4
  • 11

3 Answers3

6

Warning! For this to work properly dhcpcd needs to be disabled. See How do I set up networking/WiFi/Static IP

Don't be lazy. Configure it completely.

auto eth0                      #add this line
allow-hotplug eth0
iface eth0 inet static
        address 192.168.3.10
        netmask 255.255.255.0
        gateway 192.168.3.1
        network 192.168.3.0
        broadcast 192.168.3.255
Milliways
  • 62,573
  • 32
  • 113
  • 225
Aloha
  • 7,176
  • 1
  • 29
  • 52
2

It is likely that you are running a DHCP client. This attempts to get an IP address for your network interface, gateway address and nameservers for your DHCP server. This is over-riding what you have configured in your /etc/network/interfaces definition. The solution is to edit the /etc/dhcpcd.conf file and add static definitions for your named interface in there. See the man page for dhcpcd.conf for details and/or google for further examples of folks having configured Raspbian and DHCP client. For example:

http://sizious.com/2015/08/28/setting-a-static-ip-on-raspberry-pi-on-raspbian-20150505/

Kolban
  • 1,794
  • 2
  • 16
  • 28
2

Raspbian does not "ignore" /etc/network/interfaces but the file you listed WILL NOT set a static address, dhcpcd will still try to allocate an address.

addr:169.254.252.195 is a link-local address so for some reason this has not happened.

See How do I set up networking/WiFi/Static IP for a tutorial on how to correctly configure networking.

Alternatively you can disable dhcpcd.

Milliways
  • 62,573
  • 32
  • 113
  • 225