from scapy.all import * from scapy.contrib.coap import CoAP e = Ether(src="08:00:27:65:65:50", dst="0a:00:27:00:00:00") i = IPv6(src="fe80::0A00:27FF:FE54:2E4A", dst="fe80::0800:27ff:fe00:0000") u = UDP(sport=5683,dport=59355) c = CoAP(type='ACK', code='2.01 Created', msg_id=0, paymark=b'\xff') p = e/i/u/c # The packet p is a concatenation of all the above headers. print("Sending example packet: "); p.show() print("Example packet hexdump: "); hexdump(p) sendp(p, iface="enp7s0")