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
Is there a way we can set switches interfaces an IP ? #672
Comments
This is out-of-scope of bmv2. You need to disable IP forwarding and ideally not assign IP addresses to the interfaces assigned to bmv2, in order to ensure that packet forwarding is not done by Linux. All the functionality should be contained in your P4 programmed, which means that if your router interfaces need an IP address and MAC addresses, you should probably insert that information into a table at runtime. This is probably a simplistic view of a real-world router but you can have a |
One take-away is that (unlike OVS?) bmv2 doesn't integrate with linux networking tools such as |
Thanks for the answer ( I agree it might be out of scope), I know I could use tables to assign macs and IPs to ports and do some filtering there. I just (naively) wanted to set IPs to the switch interfaces so our students learning p4 would not ask all the time why the "l3 switch" interfaces do not have IP. I know there are some ways to bypass the linux kernel so all the IP stuff is not handled by linux. However, its fine, probably doing what you say its enough, and students should be able to "believe" a little bit more. |
There is no specific reason why I want to do this, apart from learning. When making the P4 switches act as a L3 "router", to make the scenario more realistic I assigned IPs to the switches interfaces.
The problem is that now it seems that the switch is not getting any packet, I guess that when you configure an IP for the interface the traffic is captured by the kernel first.
Is there a way to bypass this ? Does it even make sense ?
EDIT 1: while writing this I had the idea of enabling
ip_forward=1
. Magically, packets seem to arrive to the switch. I was actually not expecting this, since forward should only work when the forwarding rules are installed in the linux routing tables, right ?EDIT 2:
Actually (and now it makes more sense to me), the
ip_forward=1
thing did not solve the issue at all. It just made me think that connectivity was restored, but packets would jump directly from one host to the other without passing through the switches. This because all switches are placed to theroot
namespace (mininet default) and thus the main host is able to route from one interface to another directly (since it knows to whichsubnet
each switch interface is connected and thus it adds that to the routing table.Can
simple_switch
bypass this layer of the linux kernel ? As fas as I rememberovs
did not have this issue.The text was updated successfully, but these errors were encountered: