I am trying to have a physical wlan (AP) also attached to this switch at port 1 and connect my laptop to it and ping the enp0s25 from my laptop. Do you think such a setting would be possible? How do I assign IP addresses to enp0s25 from the switch? If I run DHCP from my server to assign an IP to my laptop - how to communicate this information to my switch and make it aware that such an address is reachable from WLAN?
If you add more options when you start siple_switch_grpc, e.g. simple_switch_grpc -i 0@enp0s25 -i 1@wlan app.json, then it should start with port 1 sending packets to and receiving packets from port wlan.
By default, any interface configuration done via Linux on interfaces has NO EFFECT on the behavior of your P4 program. You could configure your P4 program tables so that its view of IPv4, IPv6, and Ethernet address configuration has no resemblance to the configuration of the interfaces done by Linux. It is up to you and any control plane software you write for your P4 program to make its address configuration what you want.
@andyfingerhut thanks for your reply. Like you mentioned I was trying to use P4runtime shell to assign IP addresses to one of my interface bound to the switch. However I cannot seem to find any clear instructions on how to do so. If you could help me point to command that would enable me to do so/let me know if it possible to do it with p4rt shell or I should use something else please let me know. I am thankful for all the help
There are no P4 APIs that “assign an IPv4 address to an interface”, partly because it is possible to write P4 programs that do not use IPv4 addresses at all. It is intended to be a protocol-independent programming language, and while most useful P4 programs use IPv4 headers and addresses, they need not.
There are APIs for adding entries to tables that you define in your P4 program. If those have IPv4 addresses as keys or action parameters, then it is up to you and your control plane software to know whether those IPv4 addresses are “assigned to a local port”, or not. For example, some IPv4 addresses in a P4 program might be IPv4 addresses of other devices in the network, e.g. in a routing table.
I am also currently experimenting with using an ubuntu physical machine as a p4 switch and connecting two windows ports via enp2s0 and enp4s0 physical network ports. But the strange thing is that the two hosts cannot communicate with each other. Do you guarantee that the two sides can communicate with each other?Actually, I’m asking for your advice, because I feel that you have achieved the function of implementing a software switch on a physical machine
Do you handle arp requests appropriate ? Are your packets actually received by the switch ? Do your tables match ? The bmv2 log (if enabled during compiliation) should give you information whether packets are received and wether they match on your tables
I also attached physical interfaces some time ago, so it definitely works when you handle all network related things correctly (arp, possible checksum updates etc)
Here is to add the forwarding port corresponding to the forwarding IP address.
But when I bind physical port with bmv2 through sudo simple_switch --interface 0@enp2s0 --interface 1@enp4s0 test.bmv2/test.json &
I want the host connected to enp2s working on network segment 18.104.22.168 to communicate with the host connected to enp4s working on network segment 10.10.0.0.
Currently being plagued by this problem, it seems that no packages are reaching the bmv2 software switch.
Similar questions were asked:：https://forum.p4.org/t/how-to-implement-softwared-p4-switch-in-pc-or-general-server-to-achieve-better-performance/698/4?u=jyt