In have a website in my localhost:
I want to convert my laptop into a hotspot in a way that any url that the client will open in his browser will be considered as my local webserver mentioned above.
For that, I used airbase.
#put interface card in monitor mode airmon-ng start wlan0 #scanning interface to clone airodump-ng -M mon0 #create wifi access point airbase-ng -e GamingOpenWifi -c 6 -P mon0
This is my
# Listen for DHCP and DNS on this interface interface=at0 #dhcp range dhcp-range=192.168.1.10, 192.168.1.250, 12h #DNS dhcp-option=6,192.168.1.1 # router dhcp-option=3,192.168.1.1 # Servers to use server=22.214.171.124 #enable logging log-queries log-dhcp # Authoritative dhcp-authoritative
To configure the dhcp server, I ran:
#configuring tunnel interface so that we can create a bridge between our access point and our wired interface ifconfig at0 192.168.1.1 netmask 255.255.255.0 #adjust maximum transmission unit or MTU ifconfig at0 mtu 1400 #booting up dns service/ dhcp server tut 2 dnsmasq -C /etc/dnsmasq.conf -d #adding routing table route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 #enabling IP forwarding echo 1 > /proc/sys/net/ipv4/ip_forward
And these are my iptables rules:
#rule inside tunnel interface iptables --append FORWARD --in-interface at0 -j ACCEPT #allow tcp connection on port 80 and forward them to our server iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:80 iptables -t nat -A POSTROUTING -j MASQUERADE
What is not working:
- When I open a website with a domain name, I get website not found.
- When I open anything with https, I get website not found
- However, when I open any IP address, it redirects to my webserver.
How can I make 1) and 2) redirect to my local webserver as well?