1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00

set ap0 mac_addr to be different from wlan0

This commit is contained in:
Jerry Vonau 2018-11-30 02:20:20 -06:00
parent c56b9e6510
commit 71907893cb
3 changed files with 15 additions and 2 deletions

View file

@ -0,0 +1,12 @@
if [ "$interface" = "wlan0" ]; then
syslog info "50-hostapd-ap0"
sleep 2
# wpa_supplicant wants MHz for frequency= while hostapd wants channel..... whatever
# FREQ=`iw wlan0 info|grep channel|cut -d' ' -f9`
FREQ=`iw wlan0 info|grep channel|cut -d' ' -f2`
sed -i -e "s/^frequency.*/channel=$FREQ /" /etc/hostapd/hostapd.conf
syslog info "50-hostapd restarting hostapd"
systemctl daemon-reload
systemctl restart hostapd
fi

View file

@ -1,3 +1,3 @@
SUBSYSTEM=="ieee80211", ACTION=="add|change", KERNEL=="phy0", \
RUN+="/sbin/iw phy phy0 interface add ap0 type __ap", \
RUN+="MAC=`iw dev wlan0 info | grep addr | sed -e s/addr//` && /bin/ip link set ap0 address $MAC"
RUN+="/sbin/ip link set ap0 address b8:27:99:12:34:56"

View file

@ -6,7 +6,8 @@ Before=network.target dhcpcd.service
[Service]
Type=idle
PIDFile=/run/hostapd.pid
ExecStartPre=/sbin/iw phy phy0 interface add ap0 type __ap
ExecStartPre=/sbin/iw phy phy0 interface add ap0 type __ap 2>1 > /dev/null
ExecStartPre=/sbin/ip link set ap0 address b8:27:99:12:34:56 2>1 > /dev/null
ExecStart=/usr/sbin/hostapd -P /run/hostapd.pid /etc/hostapd/hostapd.conf
[Install]