Closed limlynn closed 2 years ago
Hi @limlynn 👋
From what I see, you are using Python 3.6. The latest version of icmplib compatible with this version of Python is 2.1.1. The family
parameter of the traceroute
function was introduced in version 3.0 of icmplib. So you can't currently use it.
However, for what you want to do, this parameter is not necessary. Indeed, this one is useful only if you pass to the function an FQDN (ex: github.com) and you want to make sure that the DNS lookup returns either an IPv4 address or an IPv6 address.
Since you are directly specifying an IPv6 address, you can directly call the following function and get the expected result:
hops = traceroute('2620:100:6040:18::a27d:f812', timeout=1, fast=True)
Please let me know if it works! 😉
Thank you so much I will try and let you know!
It works well!! Thank you But I cannot set up "traffic_class" for IPv6 packet. Could you please give a little advise on the setting up traffice class(tos field in IPv4) in IPv6?
Thank you for this feedback! What do you mean by "I cannot set up "traffic_class" for IPv6 packet"?
To set the traffic class field of your ICMP packets, you have a parameter to do this since the version 1.2 of icmplib:
# Ping
ping('2001:4860:4860::8888', traffic_class=184) # 184 = voice
# Multiping
multiping('2001:4860:4860::8888', traffic_class=184) # 184 = voice
# Traceroute
traceroute('2001:4860:4860::8888', traffic_class=184) # 184 = voice
You will find all the possible values here (field ToS of the table): https://github.com/ValentinBELYN/icmplib/issues/11#issuecomment-685162823 These functions work the same way whether you use IPv4 or IPv6 addresses.
Thank you so much for your effort on icmplib. I want to send traceroute with ipv6.
I tried with :
hops = traceroute('2620:100:6040:18::a27d:f812', timeout=1, fast=True, family=6)
But I got the error:
temp18@temp18-Predator-PH315-52:~/ECN_project/icmplib/examples$ sudo python3 traceroute.py Traceback (most recent call last): File "traceroute.py", line 20, in <module> hops = traceroute('2620:100:6040:18::a27d:f812', timeout=1, fast=True, family=6) File "/home/temp18/.local/lib/python3.6/site-packages/icmplib/traceroute.py", line 178, in traceroute **kwargs) TypeError: __init__() got an unexpected keyword argument 'family'
Cloud you please help on this? Thank you.