RPi Ethernet and Wifi at the same time

May 25, 2014 at 9:34 pm (computers) (, , , )

This should have been a lot easier than it ended up being!  I wanted to turn one RPi into a router between its Ethernet and Wifi networks, so that a single wifi dongle could be shared across a few Ethernet devices (via a simple dumb Ethernet hub I had lying around).

Well there are lots of posts around the Internet showing how to configure the Pi as an Access Point or an Ethernet Bridge, but in all discussions of the /etc/network/interfaces file I’ve found, no-one has really (that I’ve found so far) mentioned quite how the wpa_supplicant, ifconfig and ifplugd systems all interact and fit together.

Whilst a number of people have speculated that there might be power supply issues that will knock out your Wifi if you plug in an Ethernet cable, I didn’t see any evidence of that.  What I was actually seeing is ifplugd detecting the plugging in of the cable and then running its action scripts in /etc/ifplugd/action.d.  On my version of Raspbian, one of these scripts is a symlink over to /etc/wpa_supplicant/action_wpa.sh which basically disconnects any wpa-roam managed interfaces if the Ethernet is plugged in.

This is the designed-in behaviour, as the basic idea is that if you are using Ethernet and Wifi, then typically it will be to the same network (and ultimately connected to the Internet) so it will only need Wifi when the Ethernet is not connected.  If you have a wired connection, it will disable the wireless connection to use the wired for preference, which is the desired behaviour in the vast majority of cases.

There are a number of “fixes” around the Internet, from killing ifplugd to removing or adding auto or hotplug related options in /etc/network/interfaces.  I’m sure there must be some magic combination of options that means that the hotplugging of cables and dongles can still work, but will not automatically turn the wifi on and off – but I haven’t found it yet.

Instead, I went for the very simple, but almost definitely “quick hack” version of including an “exit 0” command near the top of /etc/wpa_supplicant/action_wpa.sh before it actually did anything.  This way, I get to keep the automatic configuration on plugging cables and dongles in, but the arrival of a new interface does not automatically shutdown the wpa-roam managed ones.

This seems to work really well for keeping Wifi connections open when plugging in an Ethernet cable.  When plugging in a Wifi dongle, that also seems to work, in that both Ethernet and Wifi end up active – although I did get a break in continuity over the Ethernet when this happened – but it reconnected again fine.

Of course, this may well completely shaft true wifi roaming across networks – I don’t know – I don’t take this RPi out and about to test it and I haven’t read enough how the wpa-roam system is meant to work to see.

I expect there is a more elegant way to achieve this, but the Internet wasn’t providing it; the Debian networking configuration manual seemed to be suggesting that I should probably use the GUI and that everything else is legacy; and I’d had enough of reading man pages. If you know of a good reference for how these scripts all interact and how this can be achieved in a nicer way, I’d very much like to hear from you!

But, this will do for now for my relatively static setup of single Wifi network, routed across to the Ethernet network.

Kevin.

 

Advertisements

Permalink 1 Comment

Parasitic Photography

May 12, 2014 at 9:42 pm (internet, odds) (, , , , , )

Do you still use a camera? I don’t really anymore. I still have one – digital naturally – and I have one on my phone. And on my tablet. And on my laptop. But I don’t very often use any of them and this paradoxically is down to social media.

Wait- doesn’t social media encourage the use of cameras on devices? Yes, lots – and this is why I only use my camera if I am doing something that is not a generally public event. I always used to use my camera for a couple of reasons:

  • When I want to explicitly send someone a picture to show them something.
  • When I am doing that I personally want to preserve.
  • Taking pictures of the kids.

I am not a photographer, so never really used a camera for the joy of finding and taking a good picture (although I do enjoy seeing good photographs that talented others often take). So, I am finding that in general, when I would have previously used a camera – when out on a trip, on holiday or when watching the kids do something – most of the time I don’t need to take my own photos. And that is where social media comes in.

I still take a camera on holiday, but these days, the kids tend to do the recording for me, as they want to be sharing their holiday with their friends via social media. They are very prolific in their picture-taking, so these days, mostly I just take a copy of their pictures when we’re done. I hardly ever take pictures on holiday, yet return with far more pictures than when I used to!

When the kids are performing somewhere, it is usually as part of a group and once again there are lots of people who will be recording, and later posting, the event via social media. In some cases the groups they are with will actively be using records of their events in their own social media publicity so official photographs are likely to be close-ups and plentiful. Yes, I sacrifice control – I don’t get to chose what the pictures are of – but there are benefits too (more on that in a moment).

If I go on trips or events myself, do I still take pictures? It depends. If I was going to a gig and it seemed big and public enough, there is a significantly high possibility that someone will be posting pictures on social media during or after the gig and I can look at those after the event. If it was a family trip, well I can rely on the kids again or maybe this is when I would take a few photos myself.

A new area where I might have started taking pictures is technical conferences. I used to wait for slides to come out and was just getting to the point where I might have used my phone camera to take a picture of a slide to record it, when social media steps in again. These days I can follow on social media and if an interesting or number laden slide pops up then someone in the audience will almost certainly tweet it for me. Either that of most slides, or a variant of them, will often appear on sites such as slideshare.

So, in an era of social media it is very often possible to avoid interrupting your own experiences with a screen providing there are enough people around you who are taking photos – who feel like the event hasn’t happened unless it has been snapped, recorded and posted for others to see. So whilst some may lament the interruptions that screens are having in our experiences, there are some positive sides – selfishly, I can preserve events for posterity, but not have to worry about seeing it through a screen myself.

Psychologist Sherry Turkle calls this drive for recording “the documented life” and discusses how many will interrupt their own experience in order to make sure it is captured with a photo. I like the recounting of the following story (from the above article):

“Last spring, I had the occasion to spend a day with the actor and comedian Aziz Ansari discussing our mutual interest in the psychology of texting. As we walked through Los Angeles, people approached him every few minutes not to ask for an autograph, but to demand a photograph. Mr. Ansari is gracious to his fans. He explained that instead of a photograph, he would offer a conversation. He inquired about their taste in music, what they liked about his performances, his stand-up, his sitcom “Parks and Recreation.” His fans were mollified but they were rarely happy. They had to walk away with nothing on their phones.

She has a lot to say on this and the wider subject of lives mediated by technology.

Depending on others like this – is this fair? Is this ethical? I don’t know. I guess people will record and post things for posterity anyway. It is somewhat parasitical to rely on them and there are issues of ownership and copyright – but then that doesn’t stop most people posting to social media and I’m pretty sure almost every license to use social media means you allow the service provider to use them as they see fit. What permissions are granted to others though to use them too? I don’t know, especially for personal use – you wouldn’t be able to re-post them as your own work naturally.

It is also one of those things that if everyone took this attitude, it wouldn’t work for anyone. There is a trade-off and many will continue to feel the need to take their own photos in order to show “there were there” regardless of others.

Sherry Turkle again:

“Technology doesn’t just do things for us. It does things to us, changing not just what we do but who we are. The selfie makes us accustomed to putting ourselves and those around us “on pause” in order to document our lives. It is an extension of how we have learned to put our conversations “on pause” when we send or receive a text, an image, an email, a call. “

Personally, I’d rather experience the things without a screen in the way, without pausing the experience, whenever I can. If I get lucky and can grab a photograph off the Internet, all good. If I can’t, well I don’t always need to subscribe to the view that I need to interrupt an experience to document it. Sometimes it’s nice simply to remember it.

Kevin.

 

Permalink Leave a Comment