How to set up a Wifi Hotspot on ubuntu14.04 and set 192.168.42.1 as wlan0 address?

I have tried to set up a hotspot on ubuntu14.04. My /etc/NetworkManager/system-connections file is shown below.

[connection]
id=hotspott
uuid=03eb0f63-e766-41df-bc04-0f30740f6841
type=802-11-wireless

[802-11-wireless]
ssid=machCochin
mode=ap

[ipv6]
method=auto

[ipv4]
method=manual


This creates the hotspot but I can't connect to the network. I have tried by replacing ipv4 section to method=shared and at that time I can join to the network from my phone but it assigned with a dynamic address.

How to create static IP for wlan0 when working as hotspot?

May be you can't connect because, NetworkManager creates an ad-hoc AP.

I would recommend to use create_ap. It's a simple script that simplifies the use of hostapd and iptables and dnsmasq.

Just clone it at github with:

git clone https://github.com/oblique/create_ap.git


Then you need some dependancies, if you don't have them installed:

sudo apt-get install iptables dnsmasq hostapd


And then, you can run it from the create_ap directory:

cd create_ap
sudo ./create_ap -w 2 wlan0 eth0 MyAccessPoint MyPassPhrase


You can change it's configuration to get 192.168.42.1 as wlan IP. If I understand you correctly, use the --gateway 192.168.42.1 switch to create_ap