With this recipe we will create a wireless access point in our laptop to share our wired Internet connection. This is quite useful where you only have a wired Internet connection (e.g. my work place) for giving access to your phone.
This is done in Fedora 25 Workstation with NetworkManager.
In my laptop I have two network interfaces: enp1s0 for the wired ethernet and wlp2s0 for the wireless. I also have the default firewall configuration (all interfaces are in the default zone FedoraWorkstation).
We have to create the hotspot connection in NetworkManager. Change the PSK password to something more secure.
# nmcli connection add con-name Hotspot autoconnect no ifname wlp2s0 type wifi connection.zone trusted 802-11-wireless.mode ap 802-11-wireless.ssid my-AP 802-11-wireless-security.key-mgmt wpa-psk 802-11-wireless-security.proto rsn 802-11-wireless-security.pairwise ccmp 802-11-wireless-security.psk 12345678 ipv4.method shared ipv6.method ignore
Connection 'Hotspot' (c5fcb9b1-4d90-4847-9467-335315ba2288) successfully added.
The magic here happens with ipv4.method=shared, as NetworkManager launches a dnsmasq process and creates the appropriate NAT rules automatically.
Now you can enable/disable the hotspot with one command:
# nmcli connection up Hostspot
# nmcli connection down Hotspot
2016/11/24 Edit: Replace the script with ipv4.method=shared. Thanks to Lubomir Rintel for the tip.