cisco remove vlan add vlan

Hello,

i have an sf-300 cisco and i want to remove all vlans assigned to specific port and add the vlan i want.Can someone help me with commands in cli.Thanks.
Mark SoultchAsked:
Who is Participating?
 
Jody LemoineNetwork ArchitectCommented:
If you only need one VLAN, you can do the following:

interface FastEthernet1
 switchport trunk allowed vlan remove all
 switchport mode access
 switchport access vlan x
 no macro auto smartport

Replace "x" with whatever VLAN you wish to assign to the port.

If you need more than one, you can do this:

interface FastEthernet1
 switchport mode trunk
 switchport trunk allowed vlan remove all
 switchport trunk allowed vlan add x,y,z
 switchport trunk native vlan x (Optional)
 no macro auto smartport

Replace "x", "y" and "z" with whatever VLANs you want on the port. Optionally, if you need the native/untagged VLAN on the trunk to be something other than "1", you can use the "switchport trunk native vlan x" command to change which of the allowed VLANs will be the native/untagged one.
0
 
Mark SoultchAuthor Commented:
after remove all, i get that message

VLAN 13: Port fa22 cannot be untagged but not Egress.
0
 
Jody LemoineNetwork ArchitectCommented:
Looks like your native VLAN is set to 13 and the switch doesn't want to remove it. Try doing a "switchport trunk native vlan 1" before removing the VLANs.
0
 
Don JohnstonInstructorCommented:
switchport trunk allowed vlan x-y

This will define only the VLAN's allowed on a trunk.  You can also have discontinuous VLAN's by using the ","
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.