0

I'm building a smartphone controlled quadrotor and I have been following this guide from here.

Link

Everything was good, until I realised I could no longer use other interfaces over my pi. I have no idea why and how this has happened, but earlier I used to connect my pi to my laptop via an ethernet cable and use RDP to work on it. But now I'm unable to access any networking interface on my pi. Even if I plug in an external WiFi adapter (USB) it doesn't seem to detect. The following, I believe, should be needed

Contents of /etc/network/interfaces

# comments 
source-directory /etc/network/interfaces.d

auto lo
auto eth0 

iface lo inet dhcp
iface eth0 inet dhcp

allow-hotplug wlan0 
iface wlan0 inet static 
  <As shown in the link> 

Output of ifconfig -a shows an ethernet interface and an external USB WiFi adapter, but their identifiers are something like enx{Mac}, wln{Mac}. But wlan0 is just fine.

When I remove all of these configuration information from the /etc/network/interfaces file and simply leave it as was default, the interfaces work, but now have interface identifiers followed by Mac addresses. For eg, ethernet interface comes up as enx{Mac}. Wlan0 is fine, but when I insert the external WiFi adapter it shows as wln{Mac}.

I have prepared a fresh SD card with the same operating system (both run the latest raspbian stretch), and in that everything works just fine.

My objectives I would want to meet are:

  1. I want to be able to use other interfaces also, like eth0, wlan1 apart from the wlan0 that I use for hotspot
  2. I want to know if there is an easy way to switch the configurations so that when I don't need a hotspot, I'd be able to use everything just like a normal pi would do. In the sense use eth0, wlan0 etc to simply connect to the internet.

Any help would be appreciated.

Thanks.

2 Answers2

1

Unfortunately, there have been a lot of significant changes to recent raspbian distributions. You have just encountered the new "predictable interface naming" scheme that comes along with raspbian stretch. If you are using guides based on older versions (jessie, wheezy), you may encounter this problem.

Fortunately, you can revert to the old naming scheme by adding net.ifnames=0 to /boot/cmdline.txt. Network configuration is no longer done in /etc/network/interfaces as in previous releases.

Be aware that there are other significant changes, including to the init script process.

Where possible, validate the OS version a howto is based on, or at least the date to give yourself an idea of what to expect.

bobstro
  • 3,978
  • 12
  • 27
  • That's a decent direction. Could you please point me to some resources where I can get some information on this? Like what to do to meet my objectives..? Thanks! – user148898 Jan 04 '18 at 16:36
  • Just include "raspbian stretch" in your searches to help narrow things down. Don't forget that raspbian is based on debian, so you can follow the changes in debian (https://www.debian.org/releases/stable/amd64/release-notes/ch-whats-new.en.html#new-interface-names) I've been able to find answers to most issues that way. The conversion to ```systemd``` actually pre-dates stretch, but things are definitely moving towards ```systemd``` for init (startup) scripts. – bobstro Jan 04 '18 at 18:51
0

Firstly copying obsolete network settings is a bad idea. What you have will probably work, but only by accident (because dhcpcd disables itself). Even then the settings will be far from robust.

The following link shows the correct settings for networking files.

How to set up networking/WiFi

This link also explains Predictable Network Interface Names (and how to disable this feature). The recommended method is an option under Advanced Options of raspi-config - this requires an updated version of raspi-config.

However I would recommend you adjust to the new technique - this is used in most modern Linux and macOS, and for good reason. (The Pi use differs slightly from most desktop settings, because the Pi has no BIOS.)

And if you REALLY must How to set up Static IP Address although many Pi users set Static IP Address there is really no need, although setting up a Access Point is one valid use. The first link explains how to configure dhcpcd to do this.

There is no simple way to switch from AP <-> normal networking. If you need to do this you will have to setup 2 separate configuration files, and write a script to switch between them. This will require a reboot.

Milliways
  • 54,718
  • 26
  • 92
  • 182