Hi i have Cisco switch model 2960 48 ports i plane to disable three ports on it for Internet service. I want to know how can apply the command on port number 20,21and 23 to close port number 80&443 .
As I understand, you want to block http/https traffic on switch ports 20,21 and 23 so that users cannot access any web pages (http/https), is it correct?
If yes, you can try to use Port ACLs. You would need an ACL and apply it to switch ports 20,21 and 23.
Let me assume the format of your switch port 20 is f0/20, the following configuration is an example of Port ACLs on switch port 20:
ip access-list extended block-http-https deny tcp any any eq www deny tcp any any eq 443 permit ip any any interface FastEthernet0/20 switchport mode access ip access-group block-http-https in end
I hope it is helpful and answers your question.
Modification of Layer3 and above services is typically done at the gateway/router as switches do not read into frames. So, you would apply an access control list, ACL, at the gateway.
You would isolate out 'no-web' ports into a distinct VLAN then restrict for that VLAN's subnet.
A quite usual security practice is to have different VLAN's for different purposes.
And to place the switch management on the same VLAN as users, internet services is a bad practice if there isn't any special reasons for it.