DEV Community

5hfT
5hfT

Posted on

2 1

Create a hotspot in your linux(debian) machine

  • Install hostapd(hotspot server) and dnsmasq (dns dhcp server) : sudo dhclient eth0 or sudo dhclient wlan0
  • Prevent the installed services starting at the start up :

    • sudo service hostapd stop
    • sudo service dnsmasq stop
    • sudo update-rc.d hostapd disable
    • sudo update-rc.d dnsmasq disable
    • Setup the configuration file of dnsmasq : sudo gedit /etc/dnsmasq.conf
    • paste the code below :

      # Bind to only one interface
      bind-interfaces
      interface=wlan0
      dhcp-range=192.168.150.2,192.168.150.10
      
    • Setup the configuration file of hostapd : sudo gedit /etc/hostapd.conf

    • paste the code below :

      interface=wlan0
      driver=nl80211
      ssid=JackSparrow
      hw_mode=g
      channel=11
      wpa=1
      wpa_passphrase=test12345
      wpa_key_mgmt=WPA-PSK
      wpa_pairwise=TKIP CCMP
      wpa_ptk_rekey=600
      macaddr_acl=0
      

You should change the ssid and wpa_passphrase to your preferences

  • Create hotspot.sh file :sudo gedit hotspot.sh

    • paste the code below :

      #!/bin/bash
      # Start
      sudo ifconfig wlan0 192.168.150.1
      sudo service dnsmasq restart
      sudo sysctl net.ipv4.ip_forward=1
      sudo iptables -t nat -A POSTROUTING -o eth0-j MASQUERADE
      sudo hostapd /etc/hostapd.conf
      sudo iptables -D POSTROUTING -t nat -o eth0-j MASQUERADE
      sudo sysctl net.ipv4.ip_forward=0
      sudo service dnsmasq stop
      sudo service hostapd stop
      
  • Now, execute the shell script : sh hotspot.sh

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay