Hi Everyone,
I am new to Arch and have been struggling with this networking issue for some time now. Here is the situation:
I am running Arch Linux Arm on a Raspberry Pi 3. I intend to use it as a hub to connect wireless devices to so that each device (and the RPi) can communicate with each other.
I have installed hostapd and dhcpd, enabled them in systemctl (sudo systemctl enable hostapd dhcpd4). The RPi allows devices to connect to it and gives IP addresses out correctly. Note that i don't want to share the internet connection on eth0 with this network on the wlan0, just create a local network for devices to talk to each other on (and the server).
My issue is: i cannot figure out how to statically set the IP address of the server so that i am able to communicate from the server to the devices (i've tried googling this many different ways but it just comes up with guides to setting up dhcpd). My problem is solved by manually setting "ip addr add 33.3.3.1/24 broadcast 33.3.3.255 dev wlan0", but i want to automate this on boot. I have attempted to use netctl to statically set the IP of wlan0, but it does not work. I don't think this is the right use case for netctl, i am not connecting to the network using the ssid/password as it is already connected from my understanding. I have also tried doing this in a service, but again, it only works if i restart the service.
My config files for service, hostpd and dhcpd are as follows:
hostapd:
$this->bbcode_second_pass_code('', 'interface=wlan0
hw_mode=g
channel=11
ieee80211n=1
wmm_enabled=1
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
macaddr_acl=0
ignore_broadcast_ssid=0
ssid=rpiAP
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wpa_passphrase=****
')
dhcpd:
$this->bbcode_second_pass_code('', '
authoritative;
default-lease-time 600;
max-lease-time 7200;
subnet 33.3.3.0 netmask 255.255.255.0 {
interface wlan0;
local-address 33.3.3.1;
range 33.3.3.10 33.3.3.245;
# option domain-name-servers 8.8.8.8, 8.8.4.4;
option routers 33.3.3.1;
option broadcast-address 33.3.3.255;
option subnet-mask 255.255.255.0;
}
subnet 192.168.0.0 netmask 255.255.255.0 {
interface eth0;
}
')
AP.service in /etc/systemd/system:
$this->bbcode_second_pass_code('', '
[Unit]
Description=AP
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-wlan0.device
After=sys-subsystem-net-devices-wlan0.device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set dev wlan0 up
ExecStart=/sbin/ip addr add 33.3.3.1/24 broadcast 33.3.3.255 dev wlan0
ExecStop=/sbin/ip addr flush dev wlan0
ExecStop=/sbin/ip link set dev wlan0 down
[Install]
WantedBy=multi-user.target
')
The output of "sudo systemctl status hostapd dhcpd4":
$this->bbcode_second_pass_code('', '
* hostapd.service - Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Loaded: loaded (/usr/lib/systemd/system/hostapd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2016-06-30 00:19:35 AEST; 7s ago
Main PID: 873 (hostapd)
Tasks: 1 (limit: 512)
CGroup: /system.slice/hostapd.service
`-873 /usr/bin/hostapd /etc/hostapd/hostapd.conf
Jun 30 00:19:35 alarmpi systemd[1]: Started Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator.
Jun 30 00:19:35 alarmpi hostapd[873]: Configuration file: /etc/hostapd/hostapd.conf
Jun 30 00:19:35 alarmpi hostapd[873]: Failed to create interface mon.wlan0: -95 (Operation not supported)
Jun 30 00:19:35 alarmpi hostapd[873]: wlan0: Could not connect to kernel driver
Jun 30 00:19:35 alarmpi hostapd[873]: Using interface wlan0 with hwaddr b8:27:eb:7c:c4:ec and ssid "rpiAP"
Jun 30 00:19:35 alarmpi hostapd[873]: wlan0: interface state UNINITIALIZED->ENABLED
Jun 30 00:19:35 alarmpi hostapd[873]: wlan0: AP-ENABLED
* dhcpd4.service - IPv4 DHCP server
Loaded: loaded (/usr/lib/systemd/system/dhcpd4.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2016-06-30 00:19:35 AEST; 8s ago
Process: 875 ExecStart=/usr/bin/dhcpd -4 -q -cf /etc/dhcpd.conf -pf /run/dhcpd4.pid (code=exited, status=0/SUCCESS)
Main PID: 877 (dhcpd)
Tasks: 1 (limit: 512)
CGroup: /system.slice/dhcpd4.service
`-877 /usr/bin/dhcpd -4 -q -cf /etc/dhcpd.conf -pf /run/dhcpd4.pid
Jun 30 00:19:35 alarmpi systemd[1]: Starting IPv4 DHCP server...
Jun 30 00:19:35 alarmpi dhcpd[875]: Source compiled to use binary-leases
Jun 30 00:19:35 alarmpi dhcpd[875]: Wrote 7 leases to leases file.
Jun 30 00:19:35 alarmpi dhcpd[875]: wlan0 missing an interface address
Jun 30 00:19:35 alarmpi dhcpd[877]: Server starting service.
Jun 30 00:19:35 alarmpi systemd[1]: Started IPv4 DHCP server.
Jun 30 00:19:38 alarmpi dhcpd[877]: DHCPDISCOVER from b8:27:eb:7c:c4:ec (alarmpi) via wlan0
Jun 30 00:19:39 alarmpi dhcpd[877]: DHCPOFFER on 33.3.3.10 to b8:27:eb:7c:c4:ec (alarmpi) via wlan0
Jun 30 00:19:40 alarmpi dhcpd[877]: DHCPDISCOVER from b8:27:eb:7c:c4:ec (alarmpi) via wlan0
Jun 30 00:19:40 alarmpi dhcpd[877]: DHCPOFFER on 33.3.3.10 to b8:27:eb:7c:c4:ec (alarmpi) via wlan0
Jun 30 00:19:44 alarmpi dhcpd[877]: DHCPDISCOVER from b8:27:eb:7c:c4:ec (alarmpi) via wlan0
Jun 30 00:19:44 alarmpi dhcpd[877]: DHCPOFFER on 33.3.3.10 to b8:27:eb:7c:c4:ec (alarmpi) via wlan0
')
I have a feeling it's got to do with the dhcpd offering 33.3.3.10 to wlan0 (the server), which it attempts to do 3 times with no success. I also think i need to remove "option routers 33.3.3.1;" from dhcpd.conf as i have read that it is used for get the gateway to the internet (which this network doesn't have).
Any help will be much appreciated. Thanks in advance, i've been struggling with this for weeks now but i think it's a bit beyond me to figure out!
-Jawj
edit: code tags