Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    [SOLVED] How to I create an access point DHCP server?

    Scheduled Pinned Locked Moved Getting Started
    dhcp
    2 Posts 1 Posters 1.4k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      BetterAuto Pybytes Beta
      last edited by BetterAuto

      How do I start up a DHCP server on the device to serve clients when I have configured the device to act as an access point? I want one client and I want it to have the IP 10.10.10.9. No gateway or DNS. Short lease. (30 min or so.)

      from network import WLAN
      import machine
      
      AP_PASSWORD = '123456'
      AP_wlan = WLAN(mode=WLAN.AP)
      AP_wlan.init(ssid='WiPy', auth = (WLAN.WPA2, AP_PASSWORD), antenna = WLAN.INT_ANT)
      AP_wlan.ifconfig(id = 1, config = ('10.10.10.10', '255.255.255.252', '0.0.0.0', '0.0.0.0'))
      
      1 Reply Last reply Reply Quote 1
      • B Offline
        BetterAuto Pybytes Beta
        last edited by

        I was doing the init wrong. I can't get it to give 10.10.10.9 (it gives 10.10.10.11) but I should be able to work with that somehow; will play with it more.

        Changes: Longer password, combine init into object instantiation.

        from network import WLAN
        import machine
        
        AP_PASSWORD = '123456abcdef'
        AP_wlan = WLAN(mode=WLAN.AP, ssid='WiPy', auth = (WLAN.WPA2, AP_PASSWORD), antenna = WLAN.INT_ANT)
        AP_wlan.ifconfig(id = 1, config = ('10.10.10.10', '255.255.255.252', '0.0.0.0', '0.0.0.0'))
        
        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom