Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a Raspberry Pi with two USB wlan adapters. wlan0 is configured with DHCP and wlan1 is configured with a static IP address and hostapd (access point) is running on this interface. The adapter supports master mode. But wlan1 never gets it's IP address after boot and the network does not work properly. Any clues to why?

/etc/network/interfaces looks like this:

auto lo

iface lo inet loopback

iface default inet dhcp

auto eth0
allow-hotplug eth0
iface eth0 inet static
 address 192.168.2.201
 netmask 255.255.255.0

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

auto wlan1
iface wlan1 inet static
address 10.0.0.1
netmask 255.255.255.0

Directly after booting the RPi, ifconfig returns the following:

eth0      Link encap:Ethernet  HWaddr b8:27:eb:47:0d:a5
      inet addr:192.168.2.201  Bcast:192.168.2.255  Mask:255.255.255.0
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:102 errors:0 dropped:1 overruns:0 frame:0
      TX packets:91 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:11281 (11.0 KiB)  TX bytes:15674 (15.3 KiB)

lo        Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      UP LOOPBACK RUNNING  MTU:16436  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:0
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

mon.wlan1 Link encap:UNSPEC  HWaddr 54-E6-FC-89-BE-4B-00-00-00-00-00-00-00-00-00-00
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:2665 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:810921 (791.9 KiB)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 80:1f:02:84:f8:3f
      UP BROADCAST MULTICAST  MTU:1500  Metric:1
      RX packets:12 errors:0 dropped:14 overruns:0 frame:0
      TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:3672 (3.5 KiB)  TX bytes:1106 (1.0 KiB)

wlan1     Link encap:Ethernet  HWaddr 54:e6:fc:89:be:4b
      UP BROADCAST RUNNING 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)

As you can see wlan1 is not assigned the expected 10.0.0.1 address. If I issue ifdown and then ifup it will get the IP address.

The command ip link shows this before doing ifdown/ifup:

4: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000

and this afterwards:

4: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000

Any help is appreciated.

share|improve this question
add comment

1 Answer 1

I think your /etc/network/interfaces is a bit bloated.

There are several points to mention here:

  • Why do you define the default-interface? That doesn't make sense to me since you've thoroughly defined every interface already.
  • For eth0 you determine to bring it up on a hotplug-event and upon the start of your system. As eth0 isn't plugable you don't have to specify both.
  • It is a good practice to indent the options for a given interface

But let's get back to topic:

I think for plugable devices it's always recommended to specify allow-hotplug and omit the auto stanza. I would try the following /etc/network/interfaces:

auto lo
auto eth0
allow-hotplug wlan0
allow-hotplug wlan1

# pattern of an interface definition
#
# iface [name of physical/logical interface] [name of address family] [method to configure the interface]
#     [option 1]
#     [option 2]
#     ...
#     [option n]

iface lo inet loopback

iface eth0 inet static
    address 192.168.2.201
    netmask 255.255.255.0

iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface wlan1 inet static
    address 10.0.0.1
    netmask 255.255.255.0

By the way: Do you have any convincing reasons not to go with an automatic network configuration tool like wicd or networkmanager?

share|improve this answer
    
NM and wicd are useful for dynamic configurations. For a static configuration, they're useless complexity. –  Gilles Jan 29 '13 at 22:39
    
Thanks. I tried your exactly your config but the with the same results unfortunately :(. Regarding GUI tools, this is a headless Raspberry Pi server so I have no interest in anything else than remote ssh management. –  LinusK Jan 30 '13 at 6:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.