CCSWE.nanoFramework.DhcpServer
1.1.19
See the version list below for details.
dotnet add package CCSWE.nanoFramework.DhcpServer --version 1.1.19
NuGet\Install-Package CCSWE.nanoFramework.DhcpServer -Version 1.1.19
<PackageReference Include="CCSWE.nanoFramework.DhcpServer" Version="1.1.19" />
paket add CCSWE.nanoFramework.DhcpServer --version 1.1.19
#r "nuget: CCSWE.nanoFramework.DhcpServer, 1.1.19"
// Install CCSWE.nanoFramework.DhcpServer as a Cake Addin #addin nuget:?package=CCSWE.nanoFramework.DhcpServer&version=1.1.19 // Install CCSWE.nanoFramework.DhcpServer as a Cake Tool #tool nuget:?package=CCSWE.nanoFramework.DhcpServer&version=1.1.19
CCSWE.nanoFramework.DhcpServer
A simple DHCP server for nanoFramework.
Overview
This started as an effort to resolve some of the issues I was having with Iot.Device.DhcpServer and ending up turning into a complete re-write. I'll take to the team about backporting some of the fixes or using this code directly.
Features
- Entire DHCP message set is supported per RFC 2131
- Lease time with renewal and rebinding options are supported
- Extensible option support with several data types supported out of the box
Usage
The simplest usage is to create a new DhcpServer
specifying the IP address of the server.
var dhcpServer = new DhcpServer(new IPAddress(new byte[] { 192, 168, 4, 1 }));
dhcpServer.Start();
Configuration
The DhcpServer
constructor also has a parameter for the subnet mask that should be used. Internally the address pool only supports a class C (255.255.255.0) network which provides 253 addresses.
var dhcpServer = new DhcpServer(new IPAddress(new byte[] { 192, 168, 4, 1 }), new IPAddress(new byte[] { 255, 255, 255, 0 }));
dhcpServer.Start();
The default LeaseTime
is two hours but this can be adjusted as needed.
dhcpServer.LeaseTime = TimeSpan.FromMinutes(5);
DHCP options
Several DHCP options are exposed directly as properties:
CaptivePortalUrl
: Gets or sets the captive portal URL.DnsServer
: Gets or sets the DNS server.
Additional options (including custom options) can be added to the OptionCollection
exposed in the Options
property.
dhcpServer.Options.Add(...);
Options are defined using the IOption
interface. Several strongly typed option implementations are provided:
IPAddressOption
: Represents a DHCP option with a singleIPAddress
value.StringOption
: Represents a DHCP option with astring
value.TimeSpanOption
: Represents a DHCP option with aTimeSpan
value.
If none of these types meet your needs you can implement the IOption
interface or use the base Option
class which handles common logic for you.
Fixes (notes for myself for back porting)
- Proper handling of unicast and broadcast requests and repsonses
- Address pool expiration no longer crashes
- Captive portal uses the correct option code
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
- nanoFramework.CoreLibrary (>= 1.15.5)
- nanoFramework.Logging (>= 1.1.124)
- nanoFramework.Runtime.Events (>= 1.11.18)
- nanoFramework.System.Collections (>= 1.5.45)
- nanoFramework.System.IO.Streams (>= 1.1.77)
- nanoFramework.System.Net (>= 1.11.14)
- nanoFramework.System.Runtime (>= 1.0.27)
- nanoFramework.System.Text (>= 1.3.1)
- nanoFramework.System.Threading (>= 1.1.32)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.22 | 20 | 1/13/2025 |
1.1.21 | 34 | 1/12/2025 |
1.1.20 | 39 | 1/12/2025 |
1.1.19 | 35 | 1/12/2025 |
1.1.18 | 35 | 1/11/2025 |
1.1.17 | 38 | 1/11/2025 |
1.0.45 | 43 | 1/10/2025 |
1.0.44 | 46 | 1/7/2025 |
1.0.43 | 74 | 1/6/2025 |
1.0.42 | 78 | 12/30/2024 |
1.0.41 | 90 | 12/16/2024 |
1.0.40 | 84 | 12/9/2024 |
1.0.39 | 83 | 12/2/2024 |
1.0.38 | 89 | 11/25/2024 |
1.0.36 | 118 | 10/21/2024 |
1.0.35 | 94 | 9/30/2024 |
1.0.34 | 93 | 9/26/2024 |
1.0.33 | 98 | 9/21/2024 |
1.0.32 | 102 | 9/13/2024 |
1.0.31 | 103 | 8/29/2024 |
1.0.30 | 116 | 8/11/2024 |
1.0.29 | 92 | 8/2/2024 |
1.0.28 | 57 | 7/29/2024 |
1.0.27 | 86 | 7/24/2024 |
1.0.26 | 115 | 6/13/2024 |
1.0.22 | 112 | 5/24/2024 |
1.0.21 | 102 | 5/23/2024 |
1.0.20 | 113 | 5/17/2024 |
1.0.19 | 110 | 5/15/2024 |
1.0.18 | 110 | 5/13/2024 |
1.0.17 | 96 | 5/10/2024 |
1.0.16 | 90 | 5/10/2024 |
1.0.15 | 109 | 4/26/2024 |
1.0.14 | 101 | 4/26/2024 |
1.0.13 | 106 | 4/10/2024 |
1.0.12 | 110 | 4/9/2024 |
1.0.11 | 112 | 4/8/2024 |
1.0.10 | 102 | 4/4/2024 |
1.0.9 | 116 | 4/3/2024 |
1.0.8 | 124 | 3/21/2024 |
1.0.7 | 132 | 2/1/2024 |
1.0.6 | 109 | 1/29/2024 |
1.0.5 | 115 | 1/26/2024 |
1.0.4 | 108 | 1/20/2024 |
1.0.3 | 214 | 11/29/2023 |
1.0.2 | 143 | 11/27/2023 |
1.0.1 | 133 | 11/26/2023 |
1.0.0 | 133 | 11/26/2023 |
0.1.2 | 132 | 11/26/2023 |