Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Scapy and Linux policy routing #836

Closed
rafajot opened this issue Sep 25, 2017 · 5 comments
Closed

[question] Scapy and Linux policy routing #836

rafajot opened this issue Sep 25, 2017 · 5 comments

Comments

@rafajot
Copy link

rafajot commented Sep 25, 2017

I have a linux host with routing policy rules that determine the gateway depending on source IP. If I set the source IP in scapy, for example

ans, unas = sr(IP(dst="180.87.124.196", src='192.xxx.xxx.xxx', ttl=1)/ICMP()/"Rozowe misie zjadaja ptysie",timeout=0.8, iface='eth3:174')

the policy routing does not work. The packet is always sent to default GW. Some time ago I saw here #762 the question about issue with scapy and iptables. So the answer was "Scapy sends packet at a low level and they are not seen by netfilter. ". I guess in this specific case the answer is going to be similar, scapy cooks packet on a different kernel layer and that's why policy based routing does not work. Is that correct?

BTW: I'm just wondering if it can have something to do with: #614

@rafajot rafajot changed the title [question] Scapy and Linux policy ruting [question] Scapy and Linux policy routing Sep 25, 2017
@guedou
Copy link
Member

guedou commented Sep 27, 2017

Scapy has its own routing table. On Linux, its content is only based on /proc/net/route that only reflect the default routing table.

You can submit a PR that implements reading routes from another source =)

@guedou guedou closed this as completed Sep 27, 2017
@rafajot
Copy link
Author

rafajot commented Sep 27, 2017

oh, thanks for this cool suggestion ;-). Is there any chance that this feature will land somewhere on to do list at least into sort of category "lets implement it when we stop willing to see our wives and kids till late night"?

@p-l-
Copy link
Member

p-l- commented Sep 27, 2017

@rafajot if that's useful and well coded, it will land!

@guedou
Copy link
Member

guedou commented Sep 28, 2017

It is now referenced in #399 =)

@schlomo
Copy link

schlomo commented Jan 27, 2023

FYI, on Linux the pyroute2 library works with policy routing as described in https://stackoverflow.com/a/28570512

But, that doesn't work on other OS which is why I came to scapy in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants