How to change route/gateway, subnet mask and ip address used by Python scapy?

Issue

This Content is from Stack Overflow. Question asked by Maya

Let’s say I have my

default gateway 192.168.10.1 , subnet mask 255.255.255.0 , interface enp2s0 and ip 192.168.10.40

If I wanted to send an ICMP packet from a different network using scapy with

gateway 192.168.40.1, subnet mask 255.255.254.0, interface enp2s0 and ip 192.168.40.224

how should I go about doing it?

i understand that i need to change the route using conf.route from here but i don’t get the exact configuration for my use case.

i’ve tried many route configs but the ping just doesn’t go through.



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?