Implementing network security at Layer 2 and Layer 3 OSI model