The P4 switch has a “normal switch” mode that is using SONIC and comes with a P4 dataplane compiled and flashed, nothing to compile using Tofino or whatsoever. This is useful when one of the switch is not used for an experiment and you want to simply wire machines virtually.
Creating a L2 bridge or a VLAN
By default, the switch boots with all interface in Router mode. They have (random 10.0…) IPs. To use those interface as a switch, you must remove the IPs before adding them to a vlan or you will get the error “Ethernet0 is a router interface”
$ show ip interfaces
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
———– ——– ——————- ———— ————– ————-
Ethernet8 10.0.0.4/31 up/down ARISTA03T2 10.0.0.
Ethernet12 10.0.0.6/31 up/down ARISTA04T2 10.0.0.7
Remove all IPv4 IPs from the interface with, for instance…
$ sudo config interface ip remove Ethernet0 10.0.0.0/31
Then, disable IPv6 link-local addresses with :
$ sudo config ipv6 disable link-local
And for each interface :
$ sudo config interface ipv6 disable use-link-local-only Ethernet0
Then save the config and reboot as the IPv6 link local will stay
$ sudo config save –y
$ sudo reboot
After a reboot, create the Vlan with :
$ sudo config vlan add 10
And add interfaces with :
$ sudo config vlan member add -u 10 Ethernet0
Personally, I saved and rebooted again afterward but it might have not be working beforehand due to an interface reset on the machines.