source and more info:
https://wiki.archlinux.org/index.php/Software_access_point
Short answer
sudo iw dev wlan0 interface add wlan0_ap type managed
sudo create_ap wlan0_ap wlan0 createap mypassword
Wi-Fi device must support AP mode
You need a nl80211 compatible wireless device, which supports the AP operating mode. This can be verified by running iw list command, under the Supported interface modes block there should be AP listed:
...
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* WDS
* monitor
* mesh point
...
Wireless client and software AP with a single Wi-Fi device
Creating a software AP is independent from your own network connection (Ethernet, wireless, ...). Many wireless devices even support simultaneous operation both as AP and as wireless "client" at the same time. Using that capability you can create a software AP acting as a "wireless repeater" for an existing network, using a single wireless device. The capability is listed in the following section in the output of iw list:
valid interface combinations:
$ iw list
...
valid interface combinations:
* #{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1, #{ P2P-device } <= 1,
total <= 3, #channels <= 2
...
The constraint #channels <= 1 means that your software AP must operate on the same channel as your Wi-Fi client connection; see the channel setting in hostapd.conf below.
If you want to use the capability/feature, perhaps because an Ethernet connection is not available, you need to create two separate virtual interfaces for using it. Virtual interfaces for a physical device wlan0 can be created as follows: The virtual interfaces with unique MAC address are created for the network connection (wlan0_sta) itself and for the software AP/hostapd "wireless repeater":
# iw dev wlan0 interface add wlan0_sta type managed
# iw dev wlan0 interface add wlan0_ap type managed
Configuration
Setting up an access point consists of two main parts:
- Setting up the Wi-Fi link layer, so that wireless clients can
associate to your computer's software access point and exchange IP
packets with it.
- Setting up the network configuration on your computer, so that it
properly relays IP packets between its own internet connection and
the wireless clients.
Tools
create_ap
The create_ap package provides a script that can create either a bridged or a NATed access point for internet sharing. It combines hostapd, dnsmasq and iptables for the good functioning of the access point. The basic syntax to create a NATed virtual network is the following:
# create_ap wlan0 eth0 MyAccessPoint MyPassPhrase