I have access to the internet via ethernet port. I've been given a WiFi dongle and a task to implement WiFi access point that devices can connect to and use internet trough the ethernet port.
So far I've managed to create the access point using hostapd and create a simple bridge interface that uses DHCP from the network behind ethernet port. So far so good, devices can access the internet. This is what my /etc/network/interfaces looks like:
auto lo br0 iface lo inet loopback allow-hotplug eth0 iface eth0 inet manual allow-hotplug wlan0 iface wlan0 inet manual iface br0 inet dhcp bridge_ports eth0 wlan0 bridge_waitport 0
Note: Network behind the ethernet port is not the internet but a simple private network (192.168.100.0/24) with access to internet. I have no knowledge about that network organization.
Additional question: While I was searching trough the internet I found out that I need to do some MAC addresses modifications, using ebtables, because AP is dropping packets form non-authorized sources, which I didn't do. What's confusing me is the fact that everything is working.
Problem with this approach is that devices that connect to the AP are given addresses from the address space of the network behind the ethernet port. What I need to do is to create private wireless network for those devices.
I've managed to set up a DHCP server for the AP interface (wlan0) using isc-dhcp-server, but it's not working very well. Devices are assigned with private addresses (network 192.168.42.10 - 192.168.42.50), but in that process DHCPDISCOVER is propagated all the way to the DHCP server in the network behind the ethernet port which creates confusion in the network and bunch of DHCP messages floating around until finally device somehow gets the intended ip address (192.168.42.10). This little knowledge I have says to me that it's happening because DHCPDISCOVER is a broadcast message (on L2 and L3) and br0 is simply forwarding traffic. Correct me if I'm wrong.
Needles to say there is no internet access on the connected device. I guess I need to route traffic between wlan0 and eth0 networks, instead of bridging it, do NAT from wlan0 to eth0 and also somehow block DHCP traffic from going outside of private wireless network.
I do know a little bit of theory about networks from networking course in my school, but absolutely no practical experience. Can someone, please, walk me trough these last steps of setting up my network? Of course any references with detailed explanations are welcome.