Gurn
Posts: 1
Joined: Thu Nov 08, 2012 12:10 am

raspbian: ifconfig <interface> down - does nothing

Thu Nov 08, 2012 1:16 am

Hi all,

I've been trying to set up my RPi as a wireless access point under 2012-09-18-wheezy-raspbian, and have started fiddling with bridge-utils. I found that I couldn't bring down the bridge interface without a reboot. In other words,

Code: Select all

ifconfig br0 down
did nothing. After troubleshooting this specific issue for a while, I noticed the same problem with other interfaces. None of the commands,

Code: Select all

ifconfig eth0 down
ifconfig wlan0 down
ip link set eth0 down
ip link set wlan0 down
had any effect. They return no errors, leave nothing in dmesg, and do not change the state of the interface. The interface still shows as 'UP' in the 'ifconfig' and 'ip link' results. 'ifdown <interface>' states that the network device in question is not configured, which is expected. I am logged in as root.

I tried commenting out any 'auto' or 'allow-hotplug' entries for those interfaces in /etc/network/interfaces and rebooting, but saw no change: the interfaces came up at boot, and could not be taken down. I tried loading a fresh 2012-10-28-wheezy-raspbian image, in case some config file was to blame, but the behavior was no different. As a sanity check I booted up archlinuxarm-13-06-2012, and all of the commands worked as I expected: once a 'down' command was issued, 'ifconfig' would no longer list the interface, and the results of 'ip link' did not list the interface as 'UP'. Going back to raspbian and unplugging the WiFi dongle (an Edimax EW-7811Un, which works nicely) makes the wlan0 interface disappear as expected, but I still can't change the state of eth0.

I have a little experience with *nix, but not enough to really know what I'm doing in the lower levels of network config. I've been googling this from several angles, but the closest I can find are issues where 'ifconfig' itself is not available.

Any ideas what might be going wrong here?

Thank you,
Gurn

afroclanis
Posts: 7
Joined: Thu Nov 29, 2012 10:54 am

Re: raspbian: ifconfig <interface> down - does nothing

Thu Nov 29, 2012 10:59 am

I am having exactly the same problem. It looks like the problem may be low level. As you say
there are no error messages.

I have tested the WLAN dongles I am using on other (x86 based) machines running a variety
of Linux distros and evryhting works fine. Is this an issue with the rpi chipset or the Arm port of
Linux?

I have been using Linux for years on x86 but have only been playing with Arm Linux (on rpi)
for about 3 weeks.

Mark

afroclanis
Posts: 7
Joined: Thu Nov 29, 2012 10:54 am

Re: raspbian: ifconfig <interface> down - does nothing

Thu Nov 29, 2012 9:49 pm

Ok - I have an ad hoc network running - I found that if you do a

Code: Select all

sudo apt-get install iw
and then run the following (tcsh) script, you can bring up an ad-hoc node on the rpi. This has been tested with the dongle supplied with the Maplin rpi kit and a Netgear ath9k dongle. For some reason, iwconfig does nothing on Rasbian - you need iw - which is not bundled in the distro by default (why not?). Sorry about using tcsh for scripting - I dislike the Bourne shell scripting language - find the C
like syntax in tcsh much more to my taste!

You go

Code: Select all

adhoc.csh <essid> <ip addr>
to bring node up, and

Code: Select all

adhoc.csh down
to bring node down. Simple ... you may need to do a

Code: Select all

sudo apt-get install tcsh
if you prefer not to recode as a sh script.

Anyway - here it is:

Code: Select all

#!/bin/tcsh
#
#----------------------------------------------------------
# Set up and ad hoc network node on Raspberry Pi
# (C) M.A. O'Neill, Tumbling Dice, 2012
#
# $1 is the ESSID (or down to shut down the iface)
#
# $2 is the i.p. address for ad hoc access on this node
#
# $3 is the mode (adhoc or mesh) could support managed
#    and monitor as well if required
#
# Works with USB dongle supplied with Maplin rpi kit
# and also with Netgear ath9k dongle on rpi - probably
# others will work too
#----------------------------------------------------------
#

#
#----------------------------------------------------------
# Get the physical and virtual addresses for wlan device
#----------------------------------------------------------
#

set wlan=`ifconfig | grep wlan | awk '{print $1}'`
set phy = `iw list | head -1 | awk '{print $2}'`

echo "adhoc version 1.00 (C) M.A. O'Neill, Tumbling Dice"

#
#----------------------------------------------------------
#  Parse command line items
#----------------------------------------------------------
#

if($1 == "" || $1 == default) then
        set essid = AdHocNet
else
        set essid = $1
endif

if($2 == "" || $1 == default) then
        set ipaddr = 192.168.0.1
else
        set ipaddr = $2
endif
if($3 == "" || $3 == adhoc || s3 == default) then
        set mode = adhoc
else
        set mode = mesh
else
        echo "ERROR: mode 'adhoc' or 'mesh' expected"
        echo ""

        exit -1
endif


if($essid == down) then

        echo "shutting down ad-hoc network node on host `hostname`"
        echo ""

        if($wlan == "") then
                echo "node is already down"
        else
                echo "shutting interface $wlan down"

                iw $wlan del
        endif

        echo ""
        echo "done"
        echo ""

        exit 1
else
        echo "bringing up ad-hoc network node on host `hostname`"
        echo ""
endif
#-----------------------------------------------------------
# Shut down interface and bring it up again in ad-hoc mode
#-----------------------------------------------------------

if($wlan != "") then
        iw $wlan del
        iw phy $phy interface add $wlan type $mode

        if($status == (-1)) then
                echo "ERROR: problem setting up $wlan"
                echo ""
                exit -1
        endif
else
        set wlan = "wlan0"
        iw phy $phy interface add $wlan type $mode

        if($status == (-1)) then
                echo "ERROR: problem setting up $wlan"
                echo ""
                exit -1
        else
                #
                #---------------------------------------
                # Seem to need this delay or ip doesn't
                # get set!
                #---------------------------------------
                #

                sleep 1
        endif
endif

echo "ESSID is             : $essid"
echo "Moode is             : $mode"
echo "IP address is        : $ipaddr"
echo "Physical interface is: $phy"
echo "Virtual interface is : $wlan"

iwconfig $wlan essid $essid
if($status == (-1)) then
        echo "ERROR: problem setting essid $essid"
        echo ""
        exit -1
endif
ifconfig $wlan inet $ipaddr
if($status == (-1)) then
        echo "ERROR: problem setting ip address $ipaddr"
        echo ""
        exit -1
endif


echo ""
echo "Done"
echo ""

exit 0







Wendo
Posts: 142
Joined: Sun Jun 10, 2012 8:27 pm

Re: raspbian: ifconfig <interface> down - does nothing

Sun Dec 02, 2012 1:03 am

Did you make sure to put sudo in from of the commands?

You need root priviledges to use ifconfig

maiku
Posts: 1
Joined: Sun Mar 24, 2013 2:47 am

Re: raspbian: ifconfig <interface> down - does nothing

Sun Mar 24, 2013 3:05 am

I was having this problem as well, but then I figured it out and thought I'd post it here for posterity.

ifplugd is what's causing this issue. Whenever the interface goes down, ifplugd sets it back up again, which makes it appear as though `ifconfig <iface> down` doesn't do anything. The workaround I found for this is to suspend the daemon from reconfiguring devices with:

Code: Select all

sudo ifplugd -S -i <iface>
And resume the daemon when you are finished with:

Code: Select all

sudo ifplugd -R -i <iface>
Between suspending and resuming the daemon, all ifconfig and related commands work as expected for me.

Hope this helps.

shutin
Posts: 6
Joined: Fri Jun 28, 2013 3:57 am

Re: raspbian: ifconfig <interface> down - does nothing

Fri Jun 28, 2013 5:40 am

Man thank you for this! I was going crazy trying to figure out why ifconfig wlan0 down wasn't working! What is the point of this ifplug thing anyway? seems to cause me a LOT more headaches than whatever it could possibly be worth. It interferes with all the fun wifi tools I want to play with. Can we just disable it permanently and have a functioning system?

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: raspbian: ifconfig <interface> down - does nothing

Fri Jun 28, 2013 7:06 am

shutin wrote:Man thank you for this! I was going crazy trying to figure out why ifconfig wlan0 down wasn't working! What is the point of this ifplug thing anyway? seems to cause me a LOT more headaches than whatever it could possibly be worth. It interferes with all the fun wifi tools I want to play with. Can we just disable it permanently and have a functioning system?
You can disable it for wlan0 only.
it's useful for ethernet connections, not so much for WiFi connections
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

Return to “Troubleshooting”