network commands

check if Mac is using the new DNS
scutil --dns | grep nameserver
force DHCP renewal
sudo ipconfig set en0 DHCP

automatic DHCP:

sudo networksetup -setdhcp Wi-Fi
sudo networksetup -setdnsservers Wi-Fi empty

manually DHCP:

sudo networksetup -setmanual Wi-Fi 192.168.1.50 255.255.255.0 192.168.1.1
sudo networksetup -setdnsservers Wi-Fi 192.168.1.100 2001:8004:52b1:6a76:afea:99a1:1790:2aee
to find which process is hogging which port
  # macOS/Linux:
  lsof -i :8765

  # Alternative using netstat:
  netstat -an | grep 8765

  # Using ss (Linux):
  ss -tlnp | grep 8765