| 
									
										
										
										
											2018-08-05 11:35:54 +02:00
										 |  |  | --- | 
					
						
							| 
									
										
										
										
											2018-08-04 15:11:04 +02:00
										 |  |  | layout: post | 
					
						
							|  |  |  | title: "FreeBSD wifi configuration" | 
					
						
							|  |  |  | date: 2018-08-04 | 
					
						
							|  |  |  | comments: true | 
					
						
							|  |  |  | categories: | 
					
						
							|  |  |  |   - freebsd | 
					
						
							|  |  |  |   - notes | 
					
						
							|  |  |  |   - short | 
					
						
							|  |  |  | --- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | To setup mulitple wlan profiles on FreeBSD and connect to them | 
					
						
							|  |  |  | automatically one can use `wpa_supplicant(8)`. To do this, add | 
					
						
							|  |  |  | following entries to rc.conf(5). | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | ifconfig_wlan0="WPA DHCP" | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This tells the system to run `wpa_supplicant` and `dhcpd` on the | 
					
						
							|  |  |  | interface while coming up. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | To store wifi profiles, use `wpa_supplicant.conf(8)`. For example, to | 
					
						
							|  |  |  | add a totaly made up WPA endpoint, append | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | network={ | 
					
						
							|  |  |  | 	ssid="apOne" | 
					
						
							|  |  |  | 	psk="pass" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | To add an open wifi (don't recommend this, but if you really want to) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | network={ | 
					
						
							|  |  |  | 	ssid="CityLibrary" | 
					
						
							|  |  |  |    	key_mgmt=NONE | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Now `wpa_supplicant` will search and connect you the next available | 
					
						
							|  |  |  | AP. You can control the order by setting the `priority` key. By | 
					
						
							|  |  |  | default all networks have priority 0, the higher value, the higher | 
					
						
							|  |  |  | priority. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | This assumes you have setup your wireless card according to [FreeBSD | 
					
						
							|  |  |  | handbook](https://www.freebsd.org/doc/handbook/network-wireless.html). | 
					
						
							|  |  |  | 
 |