There are so many network emulators you can use, such as Mininet or GNS3.
I'm sure pedagogically speaking it's better to use physical devices