Layer 2 socket connection

"Martin v. Löwis" martin at
Wed Aug 15 21:05:23 CEST 2007

> I'm looking at trying to write a python script to connect to a layer 2
> bridge (no IP available).
> Looking at the sockets function, it's not clear if I can connect using
> only the mac address - it appears to want either a broadcast address
> or a specific IP address.
> Can anyone give me a clue on opening a layer 2 socket in Python?

If your operating system supports the PF_PACKET protocol family, you
can try to use that. Python only wraps the socket interface of the
operating system, so if the system's socket implementation has no
facility for that, Python cannot expose it to you, either.


More information about the Python-list mailing list