User avatar
solar3000
Posts: 984
Joined: Sat May 18, 2013 12:14 am

/etc/network/interfaces changed,weird 2 LAN IPs instead of 1

Fri May 15, 2015 3:40 pm

I copied some of the old 'interfaces' parameters like address, netmask, and gateway.
It seems to work, but hostname -I says I have two IPs.
I only have a ethernet connected. No wifi.

What's the proper configuration for static IP for just eth0 now?
Last edited by solar3000 on Fri Oct 09, 2015 6:14 am, edited 3 times in total.
Antikythera

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: /etc/network/interfaces has changed

Fri May 15, 2015 4:09 pm

solar3000 wrote:I copied some of the old 'interfaces' parameters like address, netmask, and gateway.
It seems to work, but hostname -I says I have two IPs.
I only have a ethernet connected. No wifi.

What's the proper configuration for static IP for just eth0 now?
I'm not sure what you're asking. Normally, you will have at least two IP addresses: 1) your loop back address, and 2) your network address. Typically your loop back address (ipv4) is going to be 127.0.0.1 and you network address will be 192.168.xxx.xxx depending on your home router, dhcp, etc.

If you're using ipv6 things are a little different... and often ipv6 loop backs will be configured preparing for the time when ipv6 is the standard everywhere (still not there yet).

There is no 'proper' static configuration for ip/ it depends on whether you're using ipv4 or ipv6, whether you get your static address from dhcp (yes, that's possible) or whether you hard-code it (not a good idea, but folks still do that) and how your router's subnet is configured... some use 192.168.1.xxx some use 192.168.0.xxx just depends. Some folks use the reserved addresses in the 10.xxx.xxx.xxx range too.

Do some readng.
marcus
:ugeek:

hippy
Posts: 2344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: /etc/network/interfaces has changed

Fri May 15, 2015 4:41 pm

There does seem to be something odd going on. I also have just a wired connection, IPV4, no Wi-Fi, and for me -

hostname -i gives 127.0.1.1
hostname -I gives 198.162.0.203

I'm not sure why it's 127.0.1.1 rather than 127.0.0.1 but otherwise both IP addresses are correct ( loop-back / DHCP assigned ). hostname -h suggests -I should be showing both but I don't know. It does however suggest that neither of the OP's addresses would be the loop-back address, unless for some reason that is appearing for the OP but not for me.

My /etc/network/interface file shows -

iface eth0 inet manual

Where I would have expected dhcp ( or static ) rather than manual. But I am seemingly getting an IP address via DHCP. That suggests something else beyond /etc/network/interfaces is affecting things.

When I changed that to a static , rebooted, then -

hostname -i gives 127.0.1.1
hostname -I gives 192.168.99.99 192.168.0.203

So now I have two IP addresses just as the OP described, a manual and a DHCP, and it does seem something beyond /etc/network/interfaces is involved. I'll admit that I could well have edited something else which I have now forgotten about which enables DHCP but everything I've read suggests the settings are only controlled by the interfaces file and am not sure where else to look.

User avatar
solar3000
Posts: 984
Joined: Sat May 18, 2013 12:14 am

Re: /etc/network/interfaces has changed

Fri May 15, 2015 6:41 pm

in the new 2015-05-05 raspbian look in /etc/network/
you'll see interfaces then theres interfaces.dpkg-old
the 'old' is what's been there all along.
the 'interfaces' config has changed.
The format is different. No one seems to notice.
Antikythera

User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: /etc/network/interfaces has changed

Fri May 15, 2015 6:49 pm

What does ifconfig show?

sudo ifconfig


?
marcus
:ugeek:

hippy
Posts: 2344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: /etc/network/interfaces has changed

Fri May 15, 2015 7:15 pm

MarkHaysHarris777 wrote:What does ifconfig show?
For me, with "iface eth0 inet manual" and getting its IP address via DHCP ...

Code: Select all

eth0      Link encap:Ethernet  HWaddr b8:27:eb:b6:78:11
          inet addr:192.168.0.203  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2281 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1116 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:115191 (112.4 KiB)  TX bytes:101193 (98.8 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:82 errors:0 dropped:0 overruns:0 frame:0
          TX packets:82 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6552 (6.3 KiB)  TX bytes:6552 (6.3 KiB)
With "iface eth0 inet static" ...

Code: Select all

eth0      Link encap:Ethernet  HWaddr b8:27:eb:b6:78:11
          inet addr:198.162.99.99  Bcast:198.162.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2714 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1386 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:136474 (133.2 KiB)  TX bytes:123923 (121.0 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:84 errors:0 dropped:0 overruns:0 frame:0
          TX packets:84 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6652 (6.4 KiB)  TX bytes:6652 (6.4 KiB)
"hostname -I" shows ...

Code: Select all

192.168.99.99 192.168.0.203 
"ip a" shows ...

Code: Select all

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether b8:27:eb:b6:78:11 brd ff:ff:ff:ff:ff:ff
    inet 192.168.99.99/24 brd 192.168.99.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.0.203/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
"netstat -nr" shows ...

Code: Select all

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
192.168.99.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0 

spl23
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 265
Joined: Fri Dec 26, 2014 11:02 am

Re: /etc/network/interfaces has changed

Fri May 15, 2015 7:44 pm

With the new network mods, DHCP is taken care of by a new package called dhcpcd. In order for this to work, the iface lines in /etc/network/interfaces need to be "manual" rather than "dhcp". This is why the file has changed, and why we've backed it up in case you want to go back, in which case you will need to uninstall raspberrypi-net-mods.

hippy
Posts: 2344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: /etc/network/interfaces has changed

Fri May 15, 2015 8:24 pm

spl23 wrote:With the new network mods, DHCP is taken care of by a new package called dhcpcd. In order for this to work, the iface lines in /etc/network/interfaces need to be "manual" rather than "dhcp". This is why the file has changed, and why we've backed it up in case you want to go back, in which case you will need to uninstall raspberrypi-net-mods.
That explains it. Many thanks.

With raspberrypi-net-mods described in the middle of "Another raspbian desktop user interface update" I thought it only affected the desktop interface side of things". Turning the TV on and re-booting shows dhcpcd doing its stuff right there -

dhcpcd[2032] : eth0 : rebinding lease of ...

So, to have only a static address, it's either enter it via the new network GUI or use the -S option as described here - http://roy.marples.name/man/html8/dhcpcd.html

Going the GUI route seems to have worked for me, got just the static address specified ( and the other static address specified in /etc/network/interfaces ), but did have to re-boot after changing the setting to get it to take effect. Using Apply wasn't enough.

Also, after re-booting the GUI icon is stuck on "eth0: Link is up, configuring".

User avatar
solar3000
Posts: 984
Joined: Sat May 18, 2013 12:14 am

Re: /etc/network/interfaces has changed

Fri May 15, 2015 9:05 pm

spl23 wrote:With the new network mods, DHCP is taken care of by a new package called dhcpcd. In order for this to work, the iface lines in /etc/network/interfaces need to be "manual" rather than "dhcp". This is why the file has changed, and why we've backed it up in case you want to go back, in which case you will need to uninstall raspberrypi-net-mods.
Thanks from me too.
OK so from now on the proper way to configure my eth0 is....
The old way is to /etc/network/interfaces.
The new is?
Antikythera

spl23
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 265
Joined: Fri Dec 26, 2014 11:02 am

Re: /etc/network/interfaces has changed

Sat May 16, 2015 2:52 pm

As hippy says, either use the GUI in the desktop, or modify the Ethernet lines in /etc/network/interfaces as before if you want a static address.

MrEngman
Posts: 3580
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: /etc/network/interfaces has changed

Sat May 16, 2015 3:05 pm

spl23 wrote:With the new network mods, DHCP is taken care of by a new package called dhcpcd. In order for this to work, the iface lines in /etc/network/interfaces need to be "manual" rather than "dhcp". This is why the file has changed, and why we've backed it up in case you want to go back, in which case you will need to uninstall raspberrypi-net-mods.
Really? I just thought it looked a real mess so replaced it with what I usually use and had no problems with eth or wifi not working. And what is raspberrypi-net-mods? Where is there documentation on the new network set up if there is any.

My Pi A running 2015-05-05 /etc/network/interfaces is

Code: Select all

auto lo
iface lo inet loopback

iface eth0 inet dhcp

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

allow-hotplug wlan1
iface wlan1 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
And I presume raspberrypi-net-mods is still installed as I haven't a clue what it is or why it is needed or not. Why is it necessary to go playing with the configuration when it worked perfectly well previously. Just going to make it doubly confusing for people setting up the networks, and don't say use X.

I guess if it ain't broke, fix it so it is.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

User avatar
solar3000
Posts: 984
Joined: Sat May 18, 2013 12:14 am

Re: /etc/network/interfaces has changed

Mon May 18, 2015 3:43 pm

I forgot to mention. Adding an entry to /etc/network/interfaces creates one IP.
The new 2015 05 05 's setup creates its own ip. so that looks like why I got two IPs when I typed hostname -I. No no one seems to know this. and it looks like no one knows how to set up a static IP in the new system either.
Antikythera

hippy
Posts: 2344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: /etc/network/interfaces has changed

Mon May 18, 2015 5:19 pm

solar3000 wrote:I forgot to mention. Adding an entry to /etc/network/interfaces creates one IP.
The new 2015 05 05 's setup creates its own ip. so that looks like why I got two IPs when I typed hostname -I. No no one seems to know this and it looks like no one knows how to set up a static IP in the new system either.
Using the GUI and specifying an IP address ( with /etc/network/interfaces set to "manual" ) gave me just a single static IP, though not entirely without other problems as described above.

User avatar
solar3000
Posts: 984
Joined: Sat May 18, 2013 12:14 am

Re: /etc/network/interfaces has changed

Mon May 18, 2015 5:42 pm

guess I'll just have to accept this for now.
I'll try again later.
Antikythera

ben2202
Posts: 2
Joined: Thu May 21, 2015 12:40 pm

Re: /etc/network/interfaces has changed

Thu May 21, 2015 1:07 pm

Hello,
See my answer in this post : viewtopic.php?t=110557&p=762332
Maybe the solution is to stay in manual (not static) and editing the /etc/dhcpcd.conf to add the reservation at this end.
Regards,
Ben

User avatar
solar3000
Posts: 984
Joined: Sat May 18, 2013 12:14 am

Re: /etc/network/interfaces has changed

Thu May 21, 2015 5:22 pm

ben, I just saw your answer.
I also just discovered the dhcpcd.conf file. I grep -ir my ip that was set using the gui from the systray and there it is. so now I guess I should just leave the /etc/network/interface file alone and just use the /etc/dhcpcd.conf file alone. I just edited the last few lines.
Antikythera

User avatar
koudstaald
Posts: 5
Joined: Mon Dec 16, 2013 4:53 pm

Re: /etc/network/interfaces has changed

Tue Jun 02, 2015 4:11 am

hippy wrote:
spl23 wrote:With the new network mods, DHCP is taken care of by a new package called dhcpcd. In order for this to work, the iface lines in /etc/network/interfaces need to be "manual" rather than "dhcp". This is why the file has changed, and why we've backed it up in case you want to go back, in which case you will need to uninstall raspberrypi-net-mods.
That explains it. Many thanks.

With raspberrypi-net-mods described in the middle of "Another raspbian desktop user interface update" I thought it only affected the desktop interface side of things". Turning the TV on and re-booting shows dhcpcd doing its stuff right there -

dhcpcd[2032] : eth0 : rebinding lease of ...

So, to have only a static address, it's either enter it via the new network GUI or use the -S option as described here - http://roy.marples.name/man/html8/dhcpcd.html

Going the GUI route seems to have worked for me, got just the static address specified ( and the other static address specified in /etc/network/interfaces ), but did have to re-boot after changing the setting to get it to take effect. Using Apply wasn't enough.

Also, after re-booting the GUI icon is stuck on "eth0: Link is up, configuring".
This issue is also discussed in viewtopic.php?f=66&t=111887
Creating a static IP the usual way in /etc/network/interfaces does indeed give the pi a static IP but the dhcpcd also collects a IP from my dhcp server. The pi has two IP addresses one static and one dhcp.

You suggest to use the -S option, but I cannot figure out where to implement this option. Does not seem to be a place to do so in the dhcpcd.conf file.

Any suggestion?

User avatar
koudstaald
Posts: 5
Joined: Mon Dec 16, 2013 4:53 pm

Re: /etc/network/interfaces has changed

Tue Jun 02, 2015 5:54 am

spl23 wrote:With the new network mods, DHCP is taken care of by a new package called dhcpcd. In order for this to work, the iface lines in /etc/network/interfaces need to be "manual" rather than "dhcp". This is why the file has changed, and why we've backed it up in case you want to go back, in which case you will need to uninstall raspberrypi-net-mods.
I finally decided to give up configuring dhcpcd for static ip (unable to figure out how to configure dhcpcd with static IP and not end up with two IP addresses - one static and on dhcp).
However, rather than removing raspberrypi-net-mods I decided to remove the dhcpcd service with the following command line:

Code: Select all

sudo update-rc.d -f dhcpcd remove
This will not boot dhcpcd at start up and all the settings from the /etc/network/interfaces are being properly implemented.
To reinstate the dhcpcd service use:

Code: Select all

sudo update-rc.d dhcpcd defaults
.
Although I do not use WIFI and the GUI, I now have the option the enable and disable the dhcpcd service without installing raspberrypi-net-mods

MJneer
Posts: 1
Joined: Mon Aug 17, 2015 7:25 pm

Re: /etc/network/interfaces has changed

Mon Aug 17, 2015 7:57 pm

Thanks for figuring this one out.
Unfortunately because of the title of this thread it is really hard to find it for people by googling.

Is it possible to change the title of this thread or maybe tag it somehow?
Most people will be looking for a solution to the inevitable consequence of the update, that is:

My Raspi 2 has two IPs
Fix double IP on Raspberry PI 2
No internet access after changing /etc/network/interfaces

so they end up with : viewtopic.php?t=110557&p=762332 (where they will not find a solution btw.)

Most galls are confused since it works for some (pre-update people who didn't care to run $ sudo-apt get update , for some time) and to those who did, and got their shiny new network update that makes the dhcp invincible.

I understand the intention of the rapberrypi fundation to have people learn Linux and leave the old networking stuff for those who want to revert, but that's a bit far going. It also makes those more knowledgeable scratch their head as to why the update is executed like this as far as I can see... Last time I checked good programming practice says you should not repeat code or functionality(?)

Hope this thread will become more visible from search engines with this post alone.

Greetings

xelius
Posts: 1
Joined: Wed Sep 02, 2015 10:16 pm

Re: /etc/network/interfaces has changed

Wed Sep 02, 2015 10:26 pm

I got this solved by editing /etc/network/interfaces as usual and added the line below to /etc/dhcpcd.conf

Code: Select all

denyinterfaces eth0
more details about dhcpcd.conf: http://roy.marples.name/man/html5/dhcpcd.conf.html

bogavante
Posts: 1
Joined: Tue Sep 08, 2015 9:16 pm

Re: /etc/network/interfaces has changed

Tue Sep 08, 2015 9:23 pm

I blindly followed @koudstaald's solution in this thread and I executed this on my headless Pi2 w latest Raspbian which was having 2 ip address(1 static + 1 dhcp):

Code: Select all

sudo update-rc.d -f dhcpcd remove
It seems like on my ignorance, I removed something that was crucial for the Pi2 to be recognized in the network, cause it has disappeared from it.

What have I done? Is there any way I can re-gain ssh access or am I out of luck?

Many thanks.

Higgs
Posts: 43
Joined: Tue May 26, 2015 2:17 pm

Re: /etc/network/interfaces has changed

Fri Sep 18, 2015 5:26 pm

Yoly Moley.........

Just getting around to trying a wifi on my Pi2 and have been going around in circles until by chance landing on this thread.

There are so many old posts about using "static" or "dhcp" in the interfaces file that I have been using those references to troubleshoot without knowing that they no longer apply (they just kept killing the Pi network connection as I went through the different suggestions).

So now I know that "static" and "dhcp" are no longer used and to leave the param as "manual". geez......

Still have a gateway that is showing up as "*", but at least dhclient run at a terminal fixes that.

There really needs to be a big bulletin board that has changes to software functionality prominently displayed in a big font that says "START HERE BEFORE LOOKING FOR POSTS TO FIX PROBLEMS!"

Edit:
Having discovered these changes in /etc/network/interfaces it has taken me only a few more minutes of trial-and-error to set a static IP for my wireless by ADDING THE CHANGES IN /etc/dhcpcd.conf rather than hacking away in /etc/network/interfaces and just breaking things without knowing why......
And it now has the proper gateway on bootup.

dmatzen
Posts: 2
Joined: Fri Oct 02, 2015 7:22 pm

Re: /etc/network/interfaces has changed

Fri Oct 02, 2015 7:29 pm

For me the simple solution turned out to be adding the line in /etc/dhcpd.conf to exclude the interface.

Thanks to xelius!

by xelius » Wed Sep 02, 2015 10:26 pm
I got this solved by editing /etc/network/interfaces as usual and added the line below to /etc/dhcpcd.conf
CODE: SELECT ALL
denyinterfaces eth0

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

Re: /etc/network/interfaces has changed

Tue Oct 06, 2015 8:51 am

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
Note the "manual" entries, no "dhcp"!

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
static routers=192.168.100.1
static domain_name_servers=8.8.8.8 8.8.4.4

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
[Edited] Note that every interface section is all by itself. Settings are not shared, so you need to add the information for every interface separately!
It says this in the manual:
interface Subsequent options are only parsed for this interface.
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
Last edited by paulv on Sat Nov 28, 2015 5:50 am, edited 2 times in total.

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

Re: /etc/network/interfaces has changed

Thu Oct 08, 2015 10:39 pm

Hey, I'm sorry but... I don't understand all those undocumented changes. I believe all tutorials all over the Internet about how to properly configure /etc/network/interfaces are now outdated and useless. And without a good tutorial, I think it's too complicated for average users to create a working configuration without having two IPs and such. I also have two IPs now since I reinstalled Raspbian, and I don't know what to do now because nobody updated his tutorial yet. :(

Return to “General discussion”

Who is online

Users browsing this forum: Yahoo [Bot] and 64 guests