Closed saboor97 closed 3 years ago
@flan can you please help me with this?
Distributor ID: Ubuntu Description: Ubuntu 16.04.5 LTS Release: 16.04 Codename: xenial This is my working environment
This is a direct side-effect of the change you made in 5dddac39c3d324dd033d0b29ed01838316bdf999. By removing the return statement, the interface name will be None
, instead of a valid identifier, like eth0
.
Until #79 is properly resolved, which I suspect is a problem because 192.168.1.1 is not an IP address bound to any interfaces on your computer (you need to use an actual assigned address), so the search is failing, albeit with an unhelpful message that I will fix if this is the case.
So, you suggest that i shall not remove the return statement, and solution to #79 is appropriate IP? fixing that will resolve both errors for me?
It's possible, but I still need information that hasn't been provided.
Without knowing your network configuration, I'm just guessing.
docker0 Link encap:Ethernet HWaddr 02:42:9e:02:c5:47 inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
docker_gwbridge Link encap:Ethernet HWaddr 02:42:18:28:68:30 inet addr:172.18.0.1 Bcast:172.18.255.255 Mask:255.255.0.0 inet6 addr: fe80::42:18ff:fe28:6830/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1960 errors:0 dropped:0 overruns:0 frame:0 TX packets:3628 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2068252 (2.0 MB) TX bytes:1193113 (1.1 MB)
ens160 Link encap:Ethernet HWaddr 00:0c:29:5c:80:c6 inet addr:10.1.2.66 Bcast:10.1.2.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe5c:80c6/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1382155 errors:0 dropped:10 overruns:0 frame:0 TX packets:44586 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:191348277 (191.3 MB) TX bytes:7117614 (7.1 MB)
is this helpful? @flan
Yes, it is.
The inet addr
values are the IPv4 addresses currently configured.
In conf.py, use one of them, whichever one is appropriate for your intended DHCP network.
Unfortunately, I don't know what your intended network topology is supposed to be, but if it's addressing the Docker containers, then you'll probably want to put DHCP on that bridge interface, at 172.18.0.1. This is just a guess, though.
If this isn't a private network, you should let your network administrator know that you're about to deploy a DHCP server so they can confirm whether there might be any impact on the environment and whether you will need to set any specific options for proper communication between hosts.
i've deployed openFaas serverless platform on docker containers, and i'm trying to run this dhcp server over a serverless platform.. yes, the network is private
so in this case i shall go with the docker containers addressing? or the machine ip of 10.1.2.66?
10.1.2.0/24 (the machine's physical interface's subnet) won't be reachable by 172.17.0.0/16 (the Docker container's subnet) without some sort of routing and a DHCP relay, so I'd imagine you'd want something in 172.17.0.0/16's space. 172.18.0.0/16 is a different subnet, so you'd still need a DHCP relay for that, but there might be some internal logic in Docker that bridges these things.
It might also be correct to run the DHCP server within a Docker instance, so the other instances can reach it locally.
I'm afraid this is a network engineering task and my experience with containers is limited to LXC, so between not really knowing what you're going for and not knowing the internals of Docker's networking stack, my ability to provide answers and guidance is limited.
I can answer technical questions, most likely, but not design ones. I'll also be offline for several hours: it's after midnight where I am; I'll respond when I can in the morning.
sure, @flan thanks for your guidance :), i'll get back to you in the morning after trying these subnets
@flan yupp you were right buddy, it worked fine for my when i changed my server ip to10.1.2.66. Thankyou soo much for your help and guidance :)
saboor@ubuntu:~/staticdhcpd/staticDHCPd$ sudo python staticDHCPd [sudo] password for saboor: 2019-04-01 11:51:18,983 : INFO : Console-based logging online 2019-04-01 11:51:18,983 : WARNING : ---------------------------------------- 2019-04-01 11:51:18,983 : WARNING : ---------------------------------------- 2019-04-01 11:51:18,983 : WARNING : ---------------------------------------- 2019-04-01 11:51:18,983 : WARNING : System startup in progress; PID=11085 2019-04-01 11:51:18,983 : WARNING : staticDHCPd version 2.0.0-rc1 : http://uguu.ca/ 2019-04-01 11:51:18,984 : WARNING : libpydhcpserver version 2.0.0-rc1 : http://uguu.ca/ 2019-04-01 11:51:18,984 : WARNING : Continuing with subsystem initialisation 2019-04-01 11:51:18,984 : WARNING : ---------------------------------------- 2019-04-01 11:51:18,984 : INFO : Webservice module enabled; configuring... 2019-04-01 11:51:19,027 : INFO : Prepared to bind to 0.0.0.0:30880 2019-04-01 11:51:19,029 : INFO : Configured Webservice engine 2019-04-01 11:51:19,031 : INFO : Webservice engine beginning normal operation 2019-04-01 11:51:19,035 : INFO : Webservice logging module enabled; configuring... 2019-04-01 11:51:19,036 : INFO : Configuring web-accessible logging... 2019-04-01 11:51:19,037 : INFO : Web-accessible logging online; buffer-size=200 2019-04-01 11:51:19,038 : INFO : Initialising custom code... 2019-04-01 11:51:19,083 : INFO : Prepared to bind to 10.1.2.66; ports: server: 67, client: 68, proxy: None; raw-response-interface: - 2019-04-01 11:51:19,141 : INFO : Configured DHCP server 2019-04-01 11:51:19,144 : INFO : DHCP engine beginning normal operation 2019-04-01 11:51:19,145 : INFO : Changing runtime permissions to UID=0, GID=0... 2019-04-01 11:51:19,147 : WARNING : ---------------------------------------- 2019-04-01 11:51:19,149 : WARNING : All subsystems initialised; now serving 2019-04-01 11:51:19,150 : WARNING : ---------------------------------------- 2019-04-01 11:51:23,751 : INFO : DISCOVER from 14:18:77:d9:16:ba via port 67 2019-04-01 11:51:23,777 : WARNING : 14:18:77:d9:16:ba was temporarily blacklisted, for 60 seconds, following DISCOVER: unknown MAC and server is not authoritative; ignoring because rejection is impossible 2019-04-01 11:51:32,317 : INFO : DISCOVER from 14:18:77:d9:17:02 via port 67 2019-04-01 11:51:32,320 : WARNING : 14:18:77:d9:17:02 was temporarily blacklisted, for 60 seconds, following DISCOVER: unknown MAC and server is not authoritative; ignoring because rejection is impossible 2019-04-01 11:52:22,039 : INFO : DISCOVER from 00:26:b9:73:78:62 via port 67 2019-04-01 11:52:22,040 : WARNING : 00:26:b9:73:78:62 was temporarily blacklisted, for 60 seconds, following DISCOVER: unknown MAC and server is not authoritative; ignoring because rejection is impossible 2019-04-01 11:53:06,790 : INFO : DISCOVER from b8:ac:6f:84:9f:8b via port 67 2019-04-01 11:53:06,791 : WARNING : b8:ac:6f:84:9f:8b was temporarily blacklisted, for 60 seconds, following DISCOVER: unknown MAC and server is not authoritative; ignoring because rejection is impossible This is what i'm getting out rightnow, what should i do now? Mr.flan
This is the primary difference between staticDHCPd and, say, the ISC's DHCP server.
The ISC's server makes dynamic, anonymous IP assignments to MACs its priority, which is the most common use-case of DHCP in most networks.
staticDHCPd was designed to do the opposite: only known MACs are supposed to get IP addresses, and tey should always get the same IP address, rather than one pulled from a pool. Its design allows for significantly more scripting to happen during the allocation and provisioning process than any other server, but it does require more of an upfront understanding of your network's topology and purpose.
Since I see that you're using SQLite as your database, instead of INI, you'll need to add an entry for this host before it can be served an IP. I'm assuming you populated the database with https://github.com/flan/staticdhcpd/blob/2.0.x/staticDHCPd/databases/sqlite.sql, but just in case you haven't, do that first. You'll then need to add a subnet row (for 10.1.2.0/8, which is what you're listening on), then a map row for each MAC you want to have the system support.
If you need the scripting support staticDHCPd offers, but also want it to be fully dynamic, look at the dyanmism extension (https://github.com/flan/staticdhcpd/blob/2.0.x/staticDHCPd/extensions/official/dynamism.py). Documentation for how to use it is in the module's header.
If you just want IP addresses and don't need any of the flexibility this system provides, though, you may want to look at the ISC's server.
Okay got it, thanks mate :) I wanted to ask one more thing that is this sever supported on windows?? I'm creating a containerized image of staticdhcp server code.. and want to run this code on my serverless platform url of http://10.1.2.66:8080 will this code produce some output there too?
On Mon, 1 Apr 2019, 8:31 pm Neil Tallim <notifications@github.com wrote:
This is the primary difference between staticDHCPd and, say, the ISC's DHCP server.
The ISC's server makes dynamic, anonymous IP assignments to MACs its priority, which is the most common use-case of DHCP in most networks.
staticDHCPd was designed to do the opposite: only known MACs are supposed to get IP addresses, and tey should always get the same IP address, rather than one pulled from a pool. Its design allows for significantly more scripting to happen during the allocation and provisioning process than any other server, but it does require more of an upfront understanding of your network's topology and purpose.
Since I see that you're using SQLite as your database, instead of INI, you'll need to add an entry for this host before it can be served an IP. I'm assuming you populated the database with https://github.com/flan/staticdhcpd/blob/2.0.x/staticDHCPd/databases/sqlite.sql, but just in case you haven't, do that first. You'll then need to add a subnet row (for 10.1.2.0/8, which is what you're listening on), then a map row for each MAC you want to have the system support.
If you need the scripting support staticDHCPd offers, but also want it to be fully dynamic, look at the dyanmism extension ( https://github.com/flan/staticdhcpd/blob/2.0.x/staticDHCPd/extensions/official/dynamism.py). Documentation for how to use it is in the module's header.
If you just want IP addresses and don't need any of the flexibility this system provides, though, you may want to look at the ISC's server.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/flan/staticdhcpd/issues/81#issuecomment-478628242, or mute the thread https://github.com/notifications/unsubscribe-auth/Auay4pUkKSCxMr8K1NgEZl8OsjTk44dHks5vciZegaJpZM4cU4Bf .
This code will not run on Windows, due to its strong dependence on Unix networking semantics (it should work in most Linux, BSD, and Mac OS environments; it might work in the Windows 10 Ubuntu subsystem, but I've neither tested it nor have any intention of using Windows to test it myself). However, it can provide addresses to Windows clients and most other devices that exist, like phones, gaming consoles, and IoT nodes.
I'm assuming that you're planning to run a cluster of Docker-based services and need a way to keep track of them as they spin up and down. If that's the case, then you'd likely want to create one persistent Linux-based Docker instance where your DHCP server will reside (regardless of whether it's staticDHCPd or another implementation) and have that serve your cluster.
I have no idea what a "serverless platform URL" is, though, and 10.0.0.0/8 is one of the special networks defined in RFC1918, so I'm unable to reach that address from outside of your environment.
Thanks, @flan now i want to stop the server. and start it again when i want to with "sudo python staticDHCPd' command how can i stop my server? Right-now on executing 'sudo python staticDHCPd' i get address already in use, system shutting down error. :(
If you started it directly like that and still have DAEMON set to False in conf.py, ^C should work, like any other shell-spawned process. Otherwise, it's forked and is now a child of init. Like any other UNIX process, you can find its PID and kill that; it will respond to TERM, but QUIT or KILL won't cause any problems if you end up sending that instead.
https://www.howtogeek.com/107217/how-to-manage-processes-from-the-linux-terminal-10-commands-you-need-to-know/ looks like a decent primer if you're new to this kind of thing.
You can't run two things on the BOOTP port at the same time (because that wouldn't make sense).
Thanks :)
saboor@ubuntu:~/staticdhcpd/staticDHCPd$ sudo python staticDHCPd 2019-04-01 10:20:41,671 : INFO : Console-based logging online 2019-04-01 10:20:41,671 : WARNING : ---------------------------------------- 2019-04-01 10:20:41,672 : WARNING : ---------------------------------------- 2019-04-01 10:20:41,672 : WARNING : ---------------------------------------- 2019-04-01 10:20:41,672 : WARNING : System startup in progress; PID=11096 2019-04-01 10:20:41,672 : WARNING : staticDHCPd version 2.0.0-rc1 : http://uguu.ca/ 2019-04-01 10:20:41,672 : WARNING : libpydhcpserver version 2.0.0-rc1 : http://uguu.ca/ 2019-04-01 10:20:41,672 : WARNING : Continuing with subsystem initialisation 2019-04-01 10:20:41,672 : WARNING : ---------------------------------------- 2019-04-01 10:20:41,673 : INFO : Webservice module enabled; configuring... 2019-04-01 10:20:41,722 : INFO : Prepared to bind to 0.0.0.0:30880 2019-04-01 10:20:41,725 : INFO : Configured Webservice engine 2019-04-01 10:20:41,727 : INFO : Webservice engine beginning normal operation 2019-04-01 10:20:41,733 : INFO : Webservice logging module enabled; configuring... 2019-04-01 10:20:41,733 : INFO : Configuring web-accessible logging... 2019-04-01 10:20:41,733 : INFO : Web-accessible logging online; buffer-size=200 2019-04-01 10:20:41,734 : INFO : Initialising custom code... 2019-04-01 10:20:41,783 : INFO : Prepared to bind to 192.168.1.1; ports: server: 67, client: 68, proxy: None; raw-response-interface: - 2019-04-01 10:20:41,828 : CRITICAL : System shutdown triggered by unhandled exception: Traceback (most recent call last): File "staticDHCPd", line 294, in
_initialiseDHCP()
File "staticDHCPd", line 224, in _initialiseDHCP
dhcp = staticdhcpdlib.dhcp.DHCPService(database)
File "/home/saboor/staticdhcpd/staticDHCPd/staticdhcpdlib/dhcp.py", line 865, in init
database
File "/home/saboor/staticdhcpd/staticDHCPd/staticdhcpdlib/dhcp.py", line 410, in init
response_interface_qtags=response_interface_qtags,
File "/home/saboor/staticdhcpd/staticDHCPd/libpydhcpserver/dhcp.py", line 115, in init
self._network_link = _NetworkLink(str(server_address), server_port, client_port, proxy_port, response_interface, response_interface_qtags=response_interface_qtags)
File "/home/saboor/staticdhcpd/staticDHCPd/libpydhcpserver/dhcp.py", line 285, in init
(dhcp_socket, proxy_socket) = self._setupListeningSockets(server_port, proxy_port, server_address)
File "/home/saboor/staticdhcpd/staticDHCPd/libpydhcpserver/dhcp.py", line 358, in _setupListeningSockets
dhcp_socket.setsockopt(socket.SOL_SOCKET, _SO_BINDTODEVICE, listen_interface)
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
TypeError: setsockopt() argument 3 must be string or read-only buffer, not None
2019-04-01 10:20:41,829 : WARNING : System shutdown beginning...