mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	set ap0 mac_addr to be different from wlan0
This commit is contained in:
		
							parent
							
								
									c56b9e6510
								
							
						
					
					
						commit
						71907893cb
					
				
					 3 changed files with 15 additions and 2 deletions
				
			
		
							
								
								
									
										12
									
								
								roles/network/templates/hostapd/50-hostapd
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								roles/network/templates/hostapd/50-hostapd
									
										
									
									
									
										Normal 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
 | 
			
		||||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue