erlane.blogg.se

Python new network mac address email
Python new network mac address email







python new network mac address email

I appreciate that this was a long-winded intro, but I'd basically like to know whether there is a practical way to implement Option C? Option C: When carrying out the TCP connection itself, check the remote MAC that the client is connecting to (from what I've seen, the ARP cache should have been updated by virtue of connecting) Option B: After the TCP connection and readout, have the client check the ARP table again, in order to make sure the it actually connected to the MAC address it thought it was connected to.

python new network mac address email

Use that to check that it's about to connect to the right host/MAC. Option A: Just before connecting to a host, have the client ping the IP it thinks it's on, in order to force an ARP refresh. The following three potential approaches have occurred to me: And based on the above approach, the client will still connect to 192.168.1.101 thinking that it's reading Host A's metrics, while it's actually now talking to Host B. At the moment that that happens, the client's ARP cache will be incorrect. But occasionally there will be an IP reassignment as DHCP leases are refreshed, and Host A will end up on 192.168.1.102, with Host B now on 192.168.1.101. Based on the ARP cache and knowledge of their MAC addresses, I can tell which is which and poll accordingly. This works most of the time, but I still encounter occasional issues due to the switching of IP addresses by hosts.įor example, for a while Host A will have IP address 192.168.1.101, and Host B will have IP address 192.168.1.102. If the MAC isn't present in the ARP cache, I force a network re-scan. Before establishing each connection to a server, I look up the MAC->IP mapping in the client's ARP cache (via a method like this).

python new network mac address email

  • I periodically run a network scan using nmap, to make sure the ARP cache is populated.
  • I have taken the usual steps to obtain a MAC->IP mapping for each of the hosts: The client needs to be able to reliably identify which of the servers it's talking to - and due to the dynamic IP assignment, the only reliable identification is based on their MAC addresses. There is some code running on a client host, which regularly polls server processes running on each of the other hosts, over TCP, to collect some metrics from each host. Due to the way that DHCP is set up the IP addresses of particular devices can change in unpredictable ways this is something I have no control over. I have an Ethernet LAN (192.168.1.0/24) with a number of hosts, which are all assigned addresses over DHCP by a router.









    Python new network mac address email