I'm using Raspbian.
Every time I turn RPi on, the network monitor icon in bottom right corner says, that wlan0 has no connection at all or the connection is limited. wpa_gui gives error Could not get status from wpa_suplicant.
These are the config files:
/etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.111
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.1.255
gateway 192.168.1.1
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
iface home inet static
address 192.168.1.110
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.1.255
gateway 192.168.1.1
iface stalk inet dhcp
/etc/wpa_suplicant/wpa_suplicant.conf (also /etc/wpa.config is a link to this one)
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="my_ssid"
psk="my_pass"
proto=RSN
key_mgmt=WPA-PSK
pairwise=TKIP
auth_alg=OPEN
id_str="home"
priority=15
}
network={
ssid=""
psk=""
key_mgmt=NONE
auth_alg=OPEN
priority=1
disabled=1
id_str="stalk"
}
FYI: my network is using only static IP and WPA2. The ethernet connection works without problems. The wifi adapter (Modecom mc-un11c) is connected to powered USB hub.
To configure the files I used this manual.
What is wrong, why does the wifi connection not work?
5 Answers 5
Have you tried only setting the SSID and PSK? I was also using a static IP and WPA 2. I had a similar problem to yours, but when I only configured the SSID and PSK it worked.
If you using hidden network you have to add:
wpa-scan-ssid 1
to /etc/network/interfaces
Based on ingo's answer, I thought of using dhcpcd.
I am Sharing my experience (Likely to be useful to newbee and irritating to masters)
I kept my old /etc/network/interface file as it is.
First, as soon as dhcpcd was started, my ssh connection hanged
After first reboot, it momentarily pinged to old( 192.168.1.2 , see question above) address. But in few seconds ping stopped.
After second reboot, I could ping and ssh 192.168.1.2.
To my surprise, Now had two ips for eth0 and wlan0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 02:81:79:1b:3c:09 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.3/24 brd 192.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
inet 192.168.1.13/24 brd 192.168.1.255 scope global secondary noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::81:79ff:fe1b:3c09/64 scope link
valid_lft forever preferred_lft forever
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 12:81:79:1b:3c:09 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.2/24 brd 192.168.1.255 scope global wlan0
valid_lft forever preferred_lft forever
inet 192.168.1.13/24 brd 192.168.1.255 scope global secondary noprefixroute wlan0 valid_lft forever preferred_lft forever
inet6 fe80::1081:79ff:fe1b:3c09/64 scope link
valid_lft forever preferred_lft forever
I think ip address of both interfaces and dhcpcd are allotted.
All IP are pinging and connecting.
What is syntax for writing static wifi (and LAN) ip in dhcpcd?
-
eth0 and wlan0 have the same ip address
192.168.1.13/24
. This is wrong. Different interfaces must have a unique ip address. I do not understand what you are doing. Please forget/etc/network/interfaces
and use its default setting without any stanza.Ingo– Ingo2020年10月15日 20:41:38 +00:00Commented Oct 15, 2020 at 20:41 -
Both 192.168.1.13 were assigned by dhcpcd. (There is no mention of them in interfaces)ShaileshKumarMPatel– ShaileshKumarMPatel2020年10月16日 05:32:27 +00:00Commented Oct 16, 2020 at 5:32
With respect to my question at https://raspberrypi.stackexchange.com/a/117643/125839 I found that,editing /etc/dhcpcd.conf file (and do not confuse with /etc/dhcp/dhcclient.conf) can force dhcpdcd to give static ip of out choice.
example (add following in /etc/dhcpcd.conf):
interface eth0
static ip_address=192.168.1.3/24
static routers=192.168.1.1
static domain_name_servers=8.8.8.8
interface wlan0
static ip_address=192.168.1.2/24
static routers=192.168.1.1
static domain_name_servers=8.8.8.8
also edit /etc/wpa_supplicant/wpa_supplicant.conf for wifi
country=IN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="My_wifi"
psk="My_Pass"
}
With dhcpcd installed and /etc/dhcpcd.conf and /etc/wpa_supplicant/wpa_supplicant.conf completes static IP allocation.
Now, /etc/network/interfaces file can only contain declaration of loopback only
Now, my only eth0 starts, wlan0 is not working. Any idea for wrong configuration?
-
To make wlan0 work, i commented out all lines for eth0 in dhcpcd.conf. Only wlan0 lines are active. Now, My eth0 is working( with dhcpcd assigned ip of 192.168.1.13). It does not allot static ip. And wlan0 is still not working. Unless, somebody really explain and help, i am going to conclude that, dhcpcd fails at allotting static ip to my eth0 and wlan0 successfully.ShaileshKumarMPatel– ShaileshKumarMPatel2020年10月16日 05:33:49 +00:00Commented Oct 16, 2020 at 5:33
Read 100s of answers for How to setup static wifi on pi
I am summarizing my experience:
Relevant for oragepi / rasberrypi
Why: a pi attached to USB power supply with no 'strings' attached is the goal
Connect with LAN (Because Wifi is not set / may get broken during trial
systemctl disable NetworkManager
(to disable nmtui)content of /etc/network/interfaces
allow-hotplug eth0 iface eth0 inet static address 192.168.1.3 netmask 255.255.255.0 gateway 192.168.1.1 #auto wlan0 allow-hotplug wlan0 iface wlan0 inet static address 192.168.1.2 netmask 255.255.255.0 gateway 192.168.1.1 wpa-ssid XYZ wpa-psk ABC
There will be many post saying that gateway line can not be duplicated. But you can
wpa-ssid and wpa-psk do not need inverted comma
wpa-psk need not be in Hex
There will be many post saying that
- only one of the two is active.
- eth0 dominating on wlan0.
- eth0 disconnected disables wlan0.
But all that is due to
auto eth0
instead useallow-hotplug eth0
auto
activates by default.allow-hotplug
activates only if connected
No need for wpa-supplicant config files
This way both LAN and wifi works with static ip
-
3The question is nearly 8 years old. Please note that your answer is not relevant for an up to date Raspberry Pi OS anymore. I don't believe anyone will use such an old operating system and the question has an accepted answer.
NetworkManager
is never used with Raspbian/RaspiOS. Also/etc/network/interfaces
isn't used since years. There is a hint in it, saying: "# Please note that this file is written to be used with dhcpcd # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'".Ingo– Ingo2020年10月12日 19:49:27 +00:00Commented Oct 12, 2020 at 19:49 -
It is also about orangepiShaileshKumarMPatel– ShaileshKumarMPatel2020年10月14日 19:41:36 +00:00Commented Oct 14, 2020 at 19:41
-
This site is only about Raspberry Pi.Ingo– Ingo2020年10月14日 21:06:37 +00:00Commented Oct 14, 2020 at 21:06
wpa-roam
withwpa-conf
in/etc/network/interfaces
as per this thread: raspberrypi.stackexchange.com/questions/3852/…wlan0
up? Check the output ofifconfig
.