You are not logged in.
💡 solution here: https://dev1galaxy.org/viewtopic.php?pid=59865#p59865
Hi folks,
I am trying to create an "ad hoc" wifi connection through wpa_supplicant; I tried to mix together several sources, but with systemd becoming every day more predominant, it is very difficult finding information for systemdless systems.
This is my adapter:
01:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network AdapterAnd the firmware is installed.
Here is my interfaces file:
# wlan0
auto wlan0
iface wlan0 inet static
address 10.1.10.1
gateway 10.1.10.254
netmask 24
#wpa-driver nl80211
wpa-conf /etc/wpa_supplicant/wpa_supplicant-wlan0.confHere my wpa_supplicant-wlan0.conf with permissions set to 600.
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
fast_reauth=1
update_config=1
ap_scan=2
# AD-HOC NETWORK
network={
ssid="ESSID"
#psk="..."
psk=YADA-YADA-YDAD
frequency=2432
mode=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
}The wifi is clearly down:
ip link show wlan0
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
link/ether b0:ac:82:ff:a8:86 brd ff:ff:ff:ff:ff:ffWhen I try to raise up the wlan0 adapter, it fails:
sudo ifup wlan0
wpa_supplicant: /usr/sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
ifup: failed to bring up wlan0And when I try to start the service alone it fails the same; wireless-tools are installed:
sudo service wpa_supplicant start
grep: /etc/init.d/wpa_supplicant: No such file or directory
wpa_supplicant: unrecognized serviceNow are two days that I am trying to troubleshoot this issue but I couldn't find any solution.
Thanks… 🙏
Last edited by Danielsan (Today 12:30:11)
Offline
I found this documentation but when I tested it out, all the connections got frozen...
Offline
this webpage shows it was last updated in 2012 which may precede some/most/all of the systemd stuff
Be Excellent to each other and Party On!
https://www.youtube.com/watch?v=rph_1DODXDU
https://en.wikipedia.org/wiki/Bill_%26_Ted%27s_Excellent_Adventure
Do unto others as you would have them do instantaneously back to you!
Offline
That page doesn't include a method to use a WPA protection, therefore any transmission on the air is plain.
Offline
I found the documentation and what I did looks right:
# mode: IEEE 802.11 operation mode
# 0 = infrastructure (Managed) mode, i.e., associate with an AP (default)
# 1 = IBSS (ad-hoc, peer-to-peer)
# 2 = AP (access point)
# Note: IBSS can only be used with key_mgmt NONE (plaintext and static WEP) and
# WPA-PSK (with proto=RSN). In addition, key_mgmt=WPA-NONE (fixed group key
# TKIP/CCMP) is available for backwards compatibility, but its use is
# deprecated. WPA-None requires following network block options:
# proto=WPA, key_mgmt=WPA-NONE, pairwise=NONE, group=TKIP (or CCMP, but not
# both), and psk must also be set.
#
# frequency: Channel frequency in megahertz (MHz) for IBSS, e.g.,
# 2412 = IEEE 802.11b/g channel 1. This value is used to configure the initial
# channel for IBSS (adhoc) networks. It is ignored in the infrastructure mode.
# In addition, this value is only used by the station that creates the IBSS. If
# an IBSS network with the configured SSID is already present, the frequency of
# the network will be used instead of this configured value.# IBSS/ad-hoc network with RSN
network={
ssid="ibss-rsn"
key_mgmt=WPA-PSK
proto=RSN
psk="12345678"
mode=1
frequency=2412
pairwise=CCMP
group=CCMP
}Offline
Found another hint:
sudo wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf -i wlan0
Successfully initialized wpa_supplicant
Note: nl80211 driver interface is not designed to be used with ap_scan=2; this can result in connection failuresI tried to change driver, clearly this wifi chipset doesn't support "ad hoc":
sudo wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf -i wlan0 -D wext
Successfully initialized wpa_supplicant
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wlan0: Trying to associate with SSID 'TEST-ESSID'
ioctl[SIOCSIWGENIE]: Operation not supported
wlan0: Association request to the driver failed
wlan0: Associated with 9a:dc:7c:a0:6d:5a
wlan0: CTRL-EVENT-CONNECTED - Connection to 9a:dc:7c:a0:6d:5a completed [id=0 id_str=]Last edited by Danielsan (2025-11-18 20:23:04)
Offline
# Note: IBSS can only be used with key_mgmt NONEkey_mgmt=WPA-PSKMake sure you terminate any\all daemons after config change and before 'ifup wlan0', wpa_supplicant daemon in particular can get 'stuck' and require killing.
Online
Hi g4sra, I will follow you advise however I bought a dongle that should support hot-spot and "ad hoc " mode, then I'll try doing other tests.
Offline
Nope. I am wrong, key management is possible in ad hoc.
For AP mode go with the 'hostapd' package ('apt show hostapd')
Online
HOSTAPD made the magic, however I am still unable to bring up wlan0:
sudo ifup wlan0
Error: ipv4: Address already assigned.
ifup: failed to bring up wlan0Offline
Worth rechecking the device really is assigned to wlan0 and not something else.. One of numerous methods:
inxi -nnOffline
@dzz if I "force" to ignore the issues I can bring up wlan0.
sudo ifup -v --ignore-errors wlan0
ifup: configuring interface wlan0=wlan0 (inet)
run-parts --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/hostapd
run-parts: executing /etc/network/if-pre-up.d/wireless-tools
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
ip addr add 10.1.10.1/255.255.255.0 broadcast 10.1.10.255 dev wlan0 label wlan0
Error: ipv4: Address already assigned.
ip link set dev wlan0 up
ip route add default via 10.1.10.254 dev wlan0 onlink
RTNETLINK answers: File exists
run-parts --verbose /etc/network/if-up.d
run-parts: executing /etc/network/if-up.d/mountnfs
run-parts: executing /etc/network/if-up.d/resolved
run-parts: executing /etc/network/if-up.d/wpasupplicantinxi -bb
Network:
Device-1: Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter
driver: rtw_8821ce
IF: wlan0 state: up mac: b0:ac:82:ff:a8:86
Device-2: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
driver: r8169
IF: eth0 state: up speed: 1000 Mbps duplex: full mac: e0:51:d8:17:8d:cd
IF-ID-1: usb0 state: unknown speed: -1 duplex: half mac: 96:e7:cd:80:f0:f7Offline
Now I have two static IPv4:
sudo ifconfig
[sudo] password for freezr:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.10.1 netmask 255.0.0.0 broadcast 10.255.255.255
inet6 fe80::e251:d8ff:fe17:8dcd prefixlen 64 scopeid 0x20<link>
ether e0:51:d8:17:8d:cd txqueuelen 1000 (Ethernet)
RX packets 947810 bytes 72203287 (68.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3407541 bytes 4858575073 (4.5 GiB)
TX errors 0 dropped 2097 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 160515 bytes 387653396 (369.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 160515 bytes 387653396 (369.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.92.39.251 netmask 255.255.255.0 broadcast 10.92.39.255
inet6 fa45::23v7:vvde:la90:d3d4 prefixlen 64 scopeid 0x20<link>
inet6 5678:lj70:4455:ddfr4:78ip:vvdd:45tr:u7t5 prefixlen 64 scopeid 0x0<global>
ether 56:a5:lp:78:f5:f3 txqueuelen 1000 (Ethernet)
RX packets 156925 bytes 214499218 (204.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 77688 bytes 11670689 (11.1 MiB)
TX errors 0 dropped 2 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.10.1 netmask 255.0.0.0 broadcast 10.255.255.255
ether b0:ac:82:ff:a8:86 txqueuelen 1000 (Ethernet)
RX packets 3262 bytes 235917 (230.3 KiB)
RX errors 0 dropped 3 overruns 0 frame 0
TX packets 3605 bytes 358278 (349.8 KiB)
TX errors 0 dropped 95 overruns 0 carrier 0 collisions 0perhaps I should made "that" bridge that I read in other articles like this one:
https://www.cyberciti.biz/faq/debian-ub … ess-point/
🤔
Offline
You cannot assign 10.1.10.1 to both eth0 and wlan0.
If you want your wireless network to be a continuation of your existing ethernet network then you need to bridge.
Or
Make a new subnet for your wireless network e.g. 10.1.11.1/255.255.255.0
You will also need a DHCP server for this new subnet and routing configured.
Online
g4sra... Got you but I am already setup this way, unless I am doing a typical pebcak mistake! 🤷
# eth0
auto eth0
iface eth0 inet static
address 10.0.10.1/24
netmask 255.255.255.0
gateway 10.0.10.254
# wlan0
auto wlan0
iface wlan0 inet static
address 10.1.10.1/24
netmask 255.255.255.0
gateway 10.1.10.254
# usb0
allow-hotplug usb0
iface usb0 inet dhcpLast edited by Danielsan (Yesterday 18:41:39)
Offline
I found the pebcak: you don't need to specify any gateway if your goal is to create a "direct connection".
Here the steps I made:
1. Install hostapd
2. modify /etc/default/hostapd:
DAEMON_CONF="/etc/hostapd/hostapd.conf"3. I need to create direct connection (crosscable), here my interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# # DHCP
# auto eth0
# allow-hotplug eth0
# iface eth0 inet dhcp
# The primary network interface
auto eth0
iface eth0 inet static
address 10.0.10.1/24
netmask 255.255.255.0
# wlan0
auto wlan0
iface wlan0 inet static
address 10.1.10.1/24
netmask 255.255.255.0
# usb0
allow-hotplug usb0
iface usb0 inet dhcp4. Create: /etc/hostapd/hostapd.conf
### Wireless network name ###
interface=wlan0
driver=nl80211
country_code=US
ssid=$ESSID-NAME
hw_mode=g
channel=1
wpa=2
wpa_passphrase=$PASSPHRASE
## Key management algorithms ##
wpa_key_mgmt=WPA-PSK
## Set cipher suites (encryption algorithms) ##
## TKIP = Temporal Key Integrity Protocol
## CCMP = AES in Counter mode with CBC-MAC
wpa_pairwise=TKIP
rsn_pairwise=CCMP
## Shared Key Authentication ##
auth_algs=1
## Accept all MAC address ###
macaddr_acl=05. restart the network: sudo service networking restart
6. start the hostapd deamon: sudo service networking start
⚠️ please be advised that I reverted the name of the interfaces to the legacy naming!
Last edited by Danielsan (Yesterday 19:28:21)
Offline