Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sample code in readme.md could not run in my computer #3

Open
younthOL opened this issue Jun 12, 2020 · 1 comment
Open

sample code in readme.md could not run in my computer #3

younthOL opened this issue Jun 12, 2020 · 1 comment

Comments

@younthOL
Copy link

I copy sample code in readme.md which function at DHCP client, my env is centos7 and python3.8.2,
my code is:
import dhcppython
client = dhcppython.client.DHCPClient(interface="wlp3s0")
lease = client.get_lease(mac_addr="fa:b3:9e:89:86:32", broadcast=True, relay=None, server="255.255.255.255", options_list=None)

why it comes :
Traceback (most recent call last):
File "dhcp_clients.py", line 8, in
client = dhcppython.client.DHCPClient(interface="wlp3s0") # wlp3s0
File "/usr/local/Python3.8/lib/python3.8/site-packages/dhcppython/client.py", line 96, in init
self.writing_sockets = self.get_writing_sockets()
File "/usr/local/Python3.8/lib/python3.8/site-packages/dhcppython/client.py", line 329, in get_writing_sockets
client_sock = self.get_socket(host, port)
File "/usr/local/Python3.8/lib/python3.8/site-packages/dhcppython/client.py", line 320, in get_socket
sock.bind((host, port))
OSError: [Errno 98] Address already in use

@lvfrazao
Copy link
Owner

Hello, you almost certainly have a DHCP client service already bound to port 68. You can check this by running something like sudo netstat -tulpn.

I suspect its probably systemd-networkd, in which case you can disable and stop it using sudo systemctl disable systemd-networkd && sudo systemctl stop systemd-networkd. I would advise re-enabling the service once you are done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants