asavah
Posts: 364
Joined: Thu Aug 14, 2014 12:49 am

Re: /etc/network/interfaces has changed

Thu Oct 08, 2015 11:46 pm

coding wrote:I believe all tutorials all over the Internet about how to properly configure /etc/network/interfaces are now outdated and useless.
Well, /etc/network/interfaces still is the proper way to configure your network for all debian based distros such as debian itself, ubuntu and the derivatives.
Why RPF engineers decided to reinvent the wheel and go their own way with dhcpcd and net-mods in raspbian ?
I assume that these changes were necessary in order to make the gui network configuration possible which makes the life easier for all not-so-techsavvy people,
who just want to connect their pi to the internet.

User avatar
DougieLawson
Posts: 36515
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: /etc/network/interfaces has changed

Fri Oct 09, 2015 5:40 am

asavah wrote: Why RPF engineers decided to reinvent the wheel and go their own way with dhcpcd and net-mods in raspbian ?
Because they put their brains in neutral and let the system coast to a halt for everyone who doesn't use the GUI in favour of making the GUI look prettier with some funky front-end.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

coding
Posts: 40
Joined: Sun Jul 20, 2014 7:23 am

Re: /etc/network/interfaces has changed

Fri Oct 09, 2015 6:03 am

I got it working now, just forgot to include "=" signs in the /etc/dhcpcd.conf.
Now there's only 1 IP address, and it's static.
Thanks @ paulv for your tutorial.

User avatar
Un4Seen
Posts: 330
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
Contact: Website

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Thu Oct 15, 2015 4:34 pm

I'm also screwed. My house's heating system relies on two RPIs and now the one which is a RPI2 can't be reached anymore. I feel I could strangle the person who came up with this change and didn't even bother to publish some documentation about how to update the configs!
Andras
http://iqjar.com

Heater
Posts: 13861
Joined: Tue Jul 17, 2012 3:02 pm

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Fri Oct 16, 2015 5:12 am

So how do we repair the damage? How do we get the old style interfaces syntax back?

I'd like my Pi to be the same as every other Linux machine I use.
Memory in C++ is a leaky abstraction .

User avatar
Un4Seen
Posts: 330
Joined: Wed Oct 31, 2012 8:43 am
Location: Cluj-Napoca, Romania
Contact: Website

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Fri Oct 16, 2015 5:44 am

Andras
http://iqjar.com

User avatar
DougieLawson
Posts: 36515
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Fri Oct 16, 2015 7:06 am

Heater wrote:So how do we repair the damage? How do we get the old style interfaces syntax back?

I'd like my Pi to be the same as every other Linux machine I use.
It's better to embrace the change and use the new method to get a static address.

/etc/network/interfaces

Code: Select all

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual
        dns-search example.co.uk
        dns-domain example.co.uk

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
        dns-search example.co.uk
        dns-domain example.co.uk
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
        dns-search example.co.uk
        dns-domain example.co.uk
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
the DNS stuff is my addition to that because I run my own domain.
/etc/dhcpcd.conf

Code: Select all

hostname
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname
interface eth0
static ip_address=192.168.1.5/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8
I've stripped out the comments to simplify that. If it's wlan0 or wlan1 change the "interface" line as appropriate.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Heater
Posts: 13861
Joined: Tue Jul 17, 2012 3:02 pm

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Fri Oct 16, 2015 7:18 am

You mean I don't get any choice but to embrace the change :)

Can I still do this:

Code: Select all

auto wlan0
iface wlan0 inet dhcp
    wpa-ssid somessid
    wpa-psk somepsk
or similar, no supplicant ?

Still think it's nuts to change such a fundamental thing from the upstream Debian way.
Memory in C++ is a leaky abstraction .

User avatar
DougieLawson
Posts: 36515
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Fri Oct 16, 2015 7:41 am

You can do that but you have to purge raspberrypi-net-mods to make it work. I'm trying to work on doing everything with Jessie's systemd and the RPF's madness as that's less likely to be broken by them in future.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Pierrot8791
Posts: 1
Joined: Fri Oct 16, 2015 12:39 pm

Re: /etc/network/interfaces has changed

Fri Oct 16, 2015 1:21 pm

paulv wrote:I also struggled a bit to get things right with Jessie, but after some cursing (why change it without a proper warning or how to), I am actually liking the new situation.

I modified my /etc/network/interfaces back to the original state:

Code: Select all

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

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

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
I modified /etc/wpa_supplicant/wpa_supplicant.conf to only have the ssid and psk information and commented everything else out.

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
   ssid="xxxx"
   psk="yyyy"
#   scan_ssid=1
#   proto=WPA2          # can be RSN (for WPA2) or WPA (for WPA1)
#   key_mgmt=WPA-PSK    # can be WPA-PSK or WPA_EAP (for enterprise networks)
#   pairwise=CCMP TKIP  # can be CCMP( for WPA2) or TKIP (for WPA1), or both
#   auth_alg=OPEN       # can be OPEN, LEAP and SHARED
#   group=CCMP TKIP
#   priority=1
}
If you also have multiple access points (home, work, school), you now only need to change this file and add more network sections (with different names) here. If needed, you can reactivate the scan and priority options.
I have not tried this, but if you want to use both wlan0 and wlan1, I understand you need to use two different wpa.conf files. Look at wpa_supplicant(8).
Because you need sudo to access this file, as before, your network access information is more protected then having it in the "public" /etc/network/interfaces file.

I then added this at the very end of the "new" /etc/dhcpcd.conf file:

Code: Select all

# Static IP configuration
interface eth0
static ip_address=192.168.100.21/24

interface wlan0
static ip_address=192.168.100.20/24

static routers=192.168.100.1
static domain_name_servers=8.8.8.8 8.8.4.4
With this setup, I can switch between LAN and/or WLAN, and have either one or both active depending on the LAN cable plugged in, or the WIFI dongle plugged in, or both.

With these settings, you will now only have the above IP addresses active (depending on cable and/or dongle) and there is no gost IP anymore.

Like I said, after some cursing, I believe it's better and more simple now. I hope this helps others too.

Paul
Paul, thanks a lot for this.
It worked perfectly for me.
Although I'm a newbie in RPI, debian, and Linux world, but there are severals days I was looking for the right way to setup static IP for the latest updated Raspian release, and finally found the solution here.
Could, this "new" method of assigning static IPs, probably also documented elsewhere, as it seems to be now the proper one.

Pierre

paulv
Posts: 558
Joined: Tue Jan 15, 2013 12:10 pm
Location: Netherlands

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Fri Oct 16, 2015 2:24 pm

Hi Pierrot,

Thanks for the compliment.
I'm not sure my solution is really complete and accurate.
Maybe one of the forum moderators can make that decision and move my post "upstream" so it can be found easier.

Paul

benryu
Posts: 26
Joined: Sat Sep 27, 2014 1:11 pm

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 12:55 am

I was trying to fix a static ip in the dhcpcd.conf file and i was looking at the lines suggested in this thread.

why should the ip be set something like 192.168.1.2/24

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

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 5:30 am

benryu wrote:I was trying to fix a static ip in the dhcpcd.conf file and i was looking at the lines suggested in this thread.

why should the ip be set something like 192.168.1.2/24
It's just an example, but the 192.168.x.y address range is the most common one reserved for Private networks that won't be seen directly on the internet. There are a couple of other ranges of network addresses too.

Most people have a 192.168.1.something IP address for their home computers.

coding
Posts: 40
Joined: Sun Jul 20, 2014 7:23 am

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 9:58 am

I did not know what the "/24" part of the IP was about. Google said /24 is a network mask of 255.255.255.0.

JWatts
Posts: 5
Joined: Sat Oct 17, 2015 7:01 pm

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 9:59 am

Hello everyone,
I seem to have a similar problem - I need to have a static IP address for wlan0 but with it set I can't access outside network from my RPi but can ping the inside network.

My settings are as follows:
/etc/network/interfacs:

Code: Select all

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

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

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
For /etc/dhcpcd.conf I've added the last lines as follows:

Code: Select all

interface wlan0
static ip_address=192.168.0.2/24
static routers=192.168.0.1
static domain_name_server=192.168.0.1
output of ifconfig for wlan0:

Code: Select all

wlan0     Link encap:Ethernet  HWaddr 00:13:ef:1a:15:fb  
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::213:efff:fe1a:15fb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:46256 errors:0 dropped:255 overruns:0 frame:0
          TX packets:3160 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4642622 (4.4 MiB)  TX bytes:329018 (321.3 KiB)
I can ping my router at 192.168.0.1 but when I try to ping outside http://www.google.com for example, I get "unknown host: http://www.google.com"

I've also tried removing dhcpcd service and then alter the /etc/network/interfaces for static IP address but result is the same - I can ping home network but can't ping outside network.

I have been struggling with this for weeks now.

paulv
Posts: 558
Joined: Tue Jan 15, 2013 12:10 pm
Location: Netherlands

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 10:06 am

Look at this site for an IP calculator and the effects of the "mysterious" /24

http://jodies.de/ipcalc?host=192.168.10 ... =24&mask2=

User avatar
DougieLawson
Posts: 36515
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 10:49 am

sudo apt-get install ipcalc

That gives you a command line program that helps make sense of all of this stuff.

Code: Select all

pi@aplus ~ $ ipcalc 192.168.0.2/24
Address:   192.168.0.2          11000000.10101000.00000000. 00000010
Netmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000
Wildcard:  0.0.0.255            00000000.00000000.00000000. 11111111
=>
Network:   192.168.0.0/24       11000000.10101000.00000000. 00000000
HostMin:   192.168.0.1          11000000.10101000.00000000. 00000001
HostMax:   192.168.0.254        11000000.10101000.00000000. 11111110
Broadcast: 192.168.0.255        11000000.10101000.00000000. 11111111
Hosts/Net: 254                   Class C, Private Internet

pi@aplus ~ $
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

paulv
Posts: 558
Joined: Tue Jan 15, 2013 12:10 pm
Location: Netherlands

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 11:38 am

JWatts,

You seem to be missing the :
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
file, which is probably why you don't get an SSID and PSK to make the WIFI connect to the router.

Look a little higher in this post for what I have in this file.
Furthermore, you don't need to add the router in the /etc/dhcpcd.conf file.
The ip address/24 does all that as you can see in my separate post and that of DougieLawson.

For whatever it's worth, follow my post to the letter and it will most likely work.
Last edited by paulv on Mon Oct 19, 2015 6:16 am, edited 1 time in total.

JWatts
Posts: 5
Joined: Sat Oct 17, 2015 7:01 pm

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 4:20 pm

Hi paulv,

I have the /etc/wpa_supplicant/wpa_supplicant.conf file:

Code: Select all

  GNU nano 2.2.6    File: /etc/wpa_supplicant/wpa_supplicant.conf               

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

network={
        ssid="VM169852-2G"
        psk="password"
        key_mgmt=WPA-PSK
}
Also if I hover over dhcpcdui on the desktop, I can see that I am connected to my WiFi.
I've deleted the router and domain_name_server from /etc/dhcpcd.conf file but still the same problem persists - I can't connect to the outside network.

paulv
Posts: 558
Joined: Tue Jan 15, 2013 12:10 pm
Location: Netherlands

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 5:05 pm

JWatts,

You showed the ifconfig result for wlan0 in your first post, but not the iwconfig command result.
Ifconfig shows that you indeed have an IP address assigned to your WIFI, but not if you managed to make a connection to the router.
Iwconfig will show if you have a WIFI connection to your router and with what SSID.
If there is a log-in issue to the router, it will show up with this information.

Make sure you have
static domain_name_servers=8.8.8.8 8.8.4.4
in your /etc/dhcpcd.conf file, just as I have. Note the space between the two IP adresses, they are for the Google DNS servers to eliminate DNS service issues from your router.

Can you show us the complete ifconfig and iwconfig results after you added the Google DNS servers and rebooted the Pi? (sometimes changes only show up after a reboot)

Good luck!

JWatts
Posts: 5
Joined: Sat Oct 17, 2015 7:01 pm

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 8:10 pm

paulv,

I've added the ''static domain_name_servers=8.8.8.8 8.8.4.4''' to /etc/dhcpcd.conf and restarted.
Here is the output of ifconfig:

Code: Select all

eth0      Link encap:Ethernet  HWaddr b8:27:eb:3e:13:8f  
          inet6 addr: fe80::ba27:ebff:fe3e:138f/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:332 errors:0 dropped:0 overruns:0 frame:0
          TX packets:332 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:26840 (26.2 KiB)  TX bytes:26840 (26.2 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:13:ef:1a:15:fb  
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::213:efff:fe1a:15fb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1137 errors:0 dropped:14 overruns:0 frame:0
          TX packets:245 errors:0 dropped:4 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:123903 (120.9 KiB)  TX bytes:42352 (41.3 KiB)
and iwconfig:

Code: Select all

wlan0     IEEE 802.11bgn  ESSID:"VM169852-2G"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.437 GHz  Access Point: E4:F4:C6:88:BA:48   
          Bit Rate:144.4 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=100/100  Signal level=88/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.

eth0      no wireless extensions.
If I understand correctly than there is a connection to the router and the line works fine. But I still am not able to connect to outside network.

User avatar
DougieLawson
Posts: 36515
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Sun Oct 18, 2015 11:38 pm

Your WLAN0 isn't associated with your access point. The most likely causes are either a) hidden SSID, b) invalid SSID or c) invalid password/pass phrase.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

JWatts
Posts: 5
Joined: Sat Oct 17, 2015 7:01 pm

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Mon Oct 19, 2015 7:13 pm

DougieLawson,

I've connected to my WiFi using the dhcpcd GUi so the SSID should be correct. If I do a

Code: Select all

 sudo dhclient -v
I get a new IP address and I have access to outside network - I am able to ping http://www.google.com. I am new to networking so I don't have much knowledge about it but does that mean that until I do sudo dhcluebt -v, my router does not recognize my Raspberry Pi? And are there any solutions?

User avatar
DougieLawson
Posts: 36515
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Mon Oct 19, 2015 7:37 pm

Try a fresh install of Raspbian Jessie on a new SDCard. If that works then you've got something to compare against your current system that doesn't work. Hopefully you'll be able to see the configuration error.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

johnn
Posts: 1
Joined: Fri Oct 23, 2015 1:26 pm
Location: Basingstoke, UK

Re: /etc/network/interfaces changed,weird 2 LAN IPs instead

Fri Oct 23, 2015 1:44 pm

This thread has put me on the right track - thanks to all who contributed.
I'm setting up a PI2 with latest Jessie as a headless access point with static wlan0, and of course every source on the web talks about editing /etc/network/interfaces. It's worked fine before, so I kept banging my head for far too long. Either wlan0 wouldn't come up, or no interfaces would come up.

Finally found this thread, and as a result I now have a working, static wlan0. Simple steps:
/etc/network/interfaces back to default:
#######
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

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

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
######

and at the end of /etc/dhcpcd.conf:
######
interface wlan0
static ip_address=192.168.0.222
static routers=192.168.0.1
static domain_name_server=192.168.0.1
######

Hope this helps someone.
John

Return to “General discussion”