{"id":81,"date":"2024-04-06T10:42:18","date_gmt":"2024-04-06T07:42:18","guid":{"rendered":"https:\/\/anomandaris.eu\/?p=81"},"modified":"2024-04-06T10:45:36","modified_gmt":"2024-04-06T07:45:36","slug":"cisco-switches-vlan-configuration-with-access-and-trunk-ports","status":"publish","type":"post","link":"https:\/\/anomandaris.eu\/index.php\/2024\/04\/06\/cisco-switches-vlan-configuration-with-access-and-trunk-ports\/","title":{"rendered":"Cisco switches VLAN configuration with access and trunk ports"},"content":{"rendered":"\n<p>Before all start with elevating access through <code>enable <\/code>command.<\/p>\n\n\n\n<p>Initial configuration of the VLAN.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Switch# conf t\nSwitch(config)# vlan 254\nSwitch(config-vlan)# name Production\nSwitch(config-vlan)# end<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>Adding interface to a single VLAN in access mode.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Switch# conf t\nSwitch(config)# interface FastEthernet 0\/2\nSwitch(config-if)# switchport mode access\nSwitch(config-if)# switchport access vlan 254\nSwitch(config-if)# end\nSwitch# copy running-config startup-config\nDestination filename &#91;startup-config]? &#91;press enter]<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>Adding interface to multiple VLANs in trunk mode. Before enabling trunk mode the port encapsulation must be set to <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-yellow-color\">dot1q<\/mark>. Below configuration will allow all VLANs on the switch. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Switch# conf t\nSwitch(config)# interface FastEthernet 0\/48\nSwitch(config-if)# switchport trunk encapsulation dot1q\nSwitch(config-if)# switchport mode trunk<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>If a set of only specific VLANs need to be allowed on that port the below configuration is needed. This will allow only VLANs 172 and 254, all other VLANs that are configured on the switch will not be available through that port.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Switch# conf t\nSwitch(config)# interface FastEthernet 0\/48\nSwitch(config-if)# switchport trunk allowed vlan 172,254<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>On a trunk configured port, a VLAN can be configured in an access mode, if that is needed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Switch# conf t\nSwitch(config)# interface FastEthernet 0\/48\nSwitch(config-if)# switchport trunk native vlan 192\nSwitch(config-if)# end\nSwitch# copy running-config startup-config\nDestination filename &#91;startup-config]? &#91;press enter]<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>If multiple interfaces need to be configured in the same way, a <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-yellow-color\">range <\/mark>can be used.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Switch# conf t\nSwitch(config)# interface range FastEthernet 0\/1 - 24\nSwitch(config-if)# switchport access vlan 254<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Before all start with elevating access through enable command. Initial configuration of the VLAN. Adding interface to a single VLAN<\/p>\n<p><a href=\"https:\/\/anomandaris.eu\/index.php\/2024\/04\/06\/cisco-switches-vlan-configuration-with-access-and-trunk-ports\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Cisco switches VLAN configuration with access and trunk ports<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","footnotes":""},"categories":[14,3],"tags":[24,19,22,27,28,26,23,35,29],"class_list":["post-81","post","type-post","status-publish","format-standard","hentry","category-cisco","category-system-administration","tag-2960s","tag-access","tag-cisco","tag-config","tag-configuration","tag-network","tag-switch","tag-trunk","tag-vlan"],"author_meta":{"display_name":"nuke","author_link":"https:\/\/anomandaris.eu\/index.php\/author\/nuke\/"},"featured_img":null,"coauthors":[],"tax_additional":{"categories":{"linked":["<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/cisco\/\" class=\"advgb-post-tax-term\">Cisco<\/a>","<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/\" class=\"advgb-post-tax-term\">System Administration<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">Cisco<\/span>","<span class=\"advgb-post-tax-term\">System Administration<\/span>"]},"tags":{"linked":["<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/\" class=\"advgb-post-tax-term\">2960s<\/a>","<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/\" class=\"advgb-post-tax-term\">access<\/a>","<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/\" class=\"advgb-post-tax-term\">cisco<\/a>","<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/\" class=\"advgb-post-tax-term\">config<\/a>","<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/\" class=\"advgb-post-tax-term\">configuration<\/a>","<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/\" class=\"advgb-post-tax-term\">network<\/a>","<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/\" class=\"advgb-post-tax-term\">switch<\/a>","<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/\" class=\"advgb-post-tax-term\">trunk<\/a>","<a href=\"https:\/\/anomandaris.eu\/index.php\/category\/system-administration\/\" class=\"advgb-post-tax-term\">vlan<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">2960s<\/span>","<span class=\"advgb-post-tax-term\">access<\/span>","<span class=\"advgb-post-tax-term\">cisco<\/span>","<span class=\"advgb-post-tax-term\">config<\/span>","<span class=\"advgb-post-tax-term\">configuration<\/span>","<span class=\"advgb-post-tax-term\">network<\/span>","<span class=\"advgb-post-tax-term\">switch<\/span>","<span class=\"advgb-post-tax-term\">trunk<\/span>","<span class=\"advgb-post-tax-term\">vlan<\/span>"]}},"comment_count":"0","relative_dates":{"created":"Posted 2 years ago","modified":"Updated 2 years ago"},"absolute_dates":{"created":"Posted on 06.04.2024","modified":"Updated on 06.04.2024"},"absolute_dates_time":{"created":"Posted on 06.04.2024 10:42","modified":"Updated on 06.04.2024 10:45"},"featured_img_caption":"","series_order":"","_links":{"self":[{"href":"https:\/\/anomandaris.eu\/index.php\/wp-json\/wp\/v2\/posts\/81","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anomandaris.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anomandaris.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anomandaris.eu\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anomandaris.eu\/index.php\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":4,"href":"https:\/\/anomandaris.eu\/index.php\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"predecessor-version":[{"id":85,"href":"https:\/\/anomandaris.eu\/index.php\/wp-json\/wp\/v2\/posts\/81\/revisions\/85"}],"wp:attachment":[{"href":"https:\/\/anomandaris.eu\/index.php\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anomandaris.eu\/index.php\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anomandaris.eu\/index.php\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}