How to Configure VLANs on a Cisco Switch

This post will deal with configuring Layer 2 VLANs on Cisco switches. Up to 4094 VLANs can be configured on Cisco catalyst switches. By default, only VLAN 1 is configured on the switch, so if you connect hosts on an out-of-the-box switch they all belong to the same Layer 2 broadcast domain.

The need to configure several Layer 2 VLANs on a switch arises from the need to segment an internal Local Area Network (LAN) into different IP subnetworks. If you want for example to separate the different departments of your enterprise into different IP subnetworks, then each department should belong to its own Layer 2 VLAN. For example, let’s assume the following scenario:

  • Accounting Department: IP Subnet 192.168.2.0/24 –> VLAN 2
  • Management Department: IP Subnet 192.168.3.0/24 –> VLAN 3
  • Engineering Department: IP Subnet 192.168.4.0/24 –> VLAN 4

By separating the internal LAN into different IP subnets (and thus different VLANs) allows the network administrators to enforce traffic restrictions if needed between departments and have better control of internal hosts.

VLAN assignment on a switch is configured on a per-interface basis. That is, each switch port interface is assigned individually into a Layer 2 VLAN. If you have more than one switch connected and you want the same VLANs to belong across all switches, then a Trunk Port must be configured between the switches. The Trunk Port passes all VLANs between the switches. Let’s see the following network scenario to help us clarify some concepts.

On the LAN network above, we have three VLANs. VLAN 2,3, and 4. VLAN 4 belongs both to SWITCH 1 and SWITCH 2, therefore we need a Trunk Port between the two switches in order for hosts in VLAN4 in Switch 1 to be able to communicate with hosts in VLAN4 in Switch 2.

The ports of the two switches shall be configured as following:

SWITCH 1:
Fe0/1 – Fe0/2 –> VLAN 2 (Accounting)
Fe0/10 – Fe0/11 –> VLAN 4 (Engineering)
Fe0/24 –> Trunk Port

SWITCH 2:
Fe0/1 – Fe0/2 –> VLAN 3 (Management)
Fe0/10 – Fe0/11 –> VLAN 4 (Engineering)
Fe0/24 –> Trunk Port

Configuration:

Switch 1 Configuration:
!  Create VLANs 2 and 4 in the switch database
Switch1# configure terminal
Switch1(config)# vlan 2
Switch1(config-vlan)# name Accounting
Switch1(config-vlan)# end

Switch1(config)# vlan 4
Switch1(config-vlan)# name Engineering
Switch1(config-vlan)# end

!  Assign Ports Fe0/1 and Fe0/2 in VLAN 2
Switch1(config)# interface fastethernet0/1
Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 2
Switch1(config-if)# end
Switch1(config)# interface fastethernet0/2
Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 2
Switch1(config-if)# end

!  Assign Ports Fe0/10 and Fe0/11 in VLAN 4
Switch1(config)# interface fastethernet0/10
Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 4
Switch1(config-if)# end
Switch1(config)# interface fastethernet0/11
Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 4
Switch1(config-if)# end

!  Create Trunk Port Fe0/24
Switch1(config)# interface fastethernet0/24
Switch1(config-if)# switchport mode trunk
Switch1(config-if)# switchport trunk encapsulation dot1q
Switch1(config-if)# end

Switch 2 Configuration:
!  Create VLANs 3 and 4 in the switch database
Switch2# configure terminal
Switch2(config)# vlan 3
Switch2(config-vlan)# name Management
Switch2(config-vlan)# end

Switch2(config)# vlan 4
Switch2(config-vlan)# name Engineering
Switch2(config-vlan)# end

!  Assign Ports Fe0/1 and Fe0/2 in VLAN 3
Switch2(config)# interface fastethernet0/1
Switch2(config-if)# switchport mode access
Switch2(config-if)# switchport access vlan 3
Switch2(config-if)# end
Switch2(config)# interface fastethernet0/2
Switch2(config-if)# switchport mode access
Switch2(config-if)# switchport access vlan 3
Switch2(config-if)# end

!  Assign Ports Fe0/10 and Fe0/11 in VLAN 4
Switch2(config)# interface fastethernet0/10
Switch2(config-if)# switchport mode access
Switch2(config-if)# switchport access vlan 4
Switch2(config-if)# end
Switch2(config)# interface fastethernet0/11
Switch2(config-if)# switchport mode access
Switch2(config-if)# switchport access vlan 4
Switch2(config-if)# end

!  Create Trunk Port Fe0/24
Switch2(config)# interface fastethernet0/24
Switch2(config-if)# switchport mode trunk
Switch2(config-if)# switchport trunk encapsulation dot1q
Switch2(config-if)# end

Get Free Cisco Tutorials – Sign Up Below

Fill out your e-mail address below to receive free
Cisco Configuration Examples and Tutorials
(Your email is safe with us)
My Email Address is:

Comments

  1. Thank you very much Admin..you are doing a great job for network administrators.

    Please i have a slight challenge i have been trying to figure out how two switches will work connecting to a fibre optic transmitter cable specifically two 3750 switches and the also the configuration to make them communicate.kindly assist .Thanks a million

  2. How would one configure a switch without any VLAN?
    Why would be a reasonable response but please assume that there is no need to segment nor controll access.

    Thank you,

    Imran

  3. Blog Admin says:

    Imran,

    A Cisco switch does not have any Vlan by default. If you get it out of the box, there is only the default Vlan (Vlan 1) which actually does not tag the traffic with any Vlan information, so its like you don’t have any vlan at all.

  4. we want to renew our company that have four departments and each department have 24 pc.my duty is to make a new wireless LAN and a vlan for each department and we receive two class c addresses from ISP.And we also start to run our own website for the products of company.

    can you suggest any scenario.
    regards

  5. Blog Admin says:

    I would do the following:

    Create a “Star” switch topology with a central Layer3 switch and “Star legs” connecting the 4 department switches. Then on each department switch create a Vlan for the specific department (where you will connect the 24 pcs) and also a Vlan for the WLan device. All department switches will connect to the central Layer 3 switch with a trunk port to carry all vlans. The Layer3 switch will have Layer3 vlan with IP address.

  6. Need some help here guys. I have a Catalyst 2960 L2 and 3960 L3 switches and as far as i know 3960 is a router switch. Is there a way the 3960 will run as a router for inter-vlan routing as we haven’t had a dedicated router yet. Or are there any other ways to configure the current switches for inter-vlan purposes?

  7. need some help guys. I have a catalyst 3960 L3 and 2960 L2 switches. Is it possible to make the 3960 function as an inter-vlan router as I haven’t had a stand alone router yet? if there are other ways for inter-vlan routing utilizing my two switches, please do let me know. Thanks.

  8. rather i have a 3560 switches… sorry for the typo.

  9. Blog Admin says:

    Yes you can use the 3560 Layer3 switch for intervlan routing. Lets say you have two vlans (vlan10 and vlan20) that you want to have routing between them. First you need to create the layer2 vlans on the 3560 and then create a layer3 SVI interface (“interface vlan 10″ for example) on the switch and assign an IP address on that SVI. Also, create an SVI for vlan 20 and assign an IP address from the other subnet. These IP addresses on the SVI interfaces will act as the default gateway for your hosts that are connected on the corresponding vlans.

  10. Thanks for your idea Blog Admin. To be straight, i am just new to this stuff. However after relentless research and reading Cisco books i have come up to this configuration of mine. please do check my settings for verification.

    By the way, have tried enrolling 2 hosts under one vlan and unable to ping each other using the same configurations below.

    User Access Verification

    Password:
    Catalyst3560>ena
    Catalyst3560>enable
    Password:
    Catalyst3560#sh ru
    Building configuration…

    Current configuration : 5938 bytes
    !
    version 12.2
    no service pad
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    service sequence-numbers
    !
    hostname Catalyst3560
    !
    boot-start-marker
    boot-end-marker
    !
    enable secret 5 $1$oBhY$Rb8SlhdSErAMpVxOFMD0h0
    enable password
    !
    !
    !
    macro global description cisco-global
    no aaa new-model
    system mtu routing 1500
    udld aggressive

    ip routing
    !
    !
    !
    mls qos map cos-dscp 0 8 16 24 32 46 46 56
    mls qos srr-queue input bandwidth 70 30
    mls qos srr-queue input threshold 1 80 90
    mls qos srr-queue input priority-queue 2 bandwidth 30
    mls qos srr-queue input cos-map queue 1 threshold 2 3
    mls qos srr-queue input cos-map queue 1 threshold 3 6 7
    mls qos srr-queue input cos-map queue 2 threshold 1 4
    mls qos srr-queue input dscp-map queue 1 threshold 2 24
    mls qos srr-queue input dscp-map queue 1 threshold 3 48 49 50 51 52 53 54 55
    mls qos srr-queue input dscp-map queue 1 threshold 3 56 57 58 59 60 61 62 63
    mls qos srr-queue input dscp-map queue 2 threshold 3 32 33 40 41 42 43 44 45
    mls qos srr-queue input dscp-map queue 2 threshold 3 46 47
    mls qos srr-queue output cos-map queue 1 threshold 3 4 5
    mls qos srr-queue output cos-map queue 2 threshold 1 2
    mls qos srr-queue output cos-map queue 2 threshold 2 3
    mls qos srr-queue output cos-map queue 2 threshold 3 6 7
    mls qos srr-queue output cos-map queue 3 threshold 3 0
    mls qos srr-queue output cos-map queue 4 threshold 3 1
    mls qos srr-queue output dscp-map queue 1 threshold 3 32 33 40 41 42 43 44 45
    mls qos srr-queue output dscp-map queue 1 threshold 3 46 47
    mls qos srr-queue output dscp-map queue 2 threshold 1 16 17 18 19 20 21 22 23
    mls qos srr-queue output dscp-map queue 2 threshold 1 26 27 28 29 30 31 34 35
    mls qos srr-queue output dscp-map queue 2 threshold 1 36 37 38 39
    mls qos srr-queue output dscp-map queue 2 threshold 2 24
    mls qos srr-queue output dscp-map queue 2 threshold 3 48 49 50 51 52 53 54 55
    mls qos srr-queue output dscp-map queue 2 threshold 3 56 57 58 59 60 61 62 63
    mls qos srr-queue output dscp-map queue 3 threshold 3 0 1 2 3 4 5 6 7
    mls qos srr-queue output dscp-map queue 4 threshold 1 8 9 11 13 15
    mls qos srr-queue output dscp-map queue 4 threshold 2 10 12 14
    mls qos queue-set output 1 threshold 1 100 100 50 200
    mls qos queue-set output 1 threshold 2 125 125 100 400
    mls qos queue-set output 1 threshold 3 100 100 100 400
    mls qos queue-set output 1 threshold 4 60 150 50 200
    mls qos queue-set output 1 buffers 15 25 40 20
    mls qos
    !
    crypto pki trustpoint TP-self-signed-1442936320
    enrollment selfsigned
    subject-name cn=IOS-Self-Signed-Certificate-1442936320
    revocation-check none
    rsakeypair TP-self-signed-1442936320
    !
    !
    crypto pki certificate chain TP-self-signed-1442936320
    certificate self-signed 01
    30820245 308201AE A0030201 02020101 300D0609 2A864886 F70D0101 04050030
    31312F30 2D060355 04031326 494F532D 53656C66 2D536967 6E65642D 43657274
    69666963 6174652D 31343432 39333633 3230301E 170D3933 30333031 30303031
    33375A17 0D323030 31303130 30303030 305A3031 312F302D 06035504 03132649
    4F532D53 656C662D 5369676E 65642D43 65727469 66696361 74652D31 34343239
    33363332 3030819F 300D0609 2A864886 F70D0101 01050003 818D0030 81890281
    8100C202 C024B854 2EBC7153 B7C57C0B 96DEBC6D DEF4AA59 80F08296 5E75C092
    D25F6A96 0E7B42E7 364E9461 C1133036 067F8E0A 9BABE393 86D9022D 035EC03A
    8A55241B 5CE78E1D 39DA7709 717F8D35 1696AACD 92388E5D 8F9F9009 DF0E6A84
    2B703250 C760AA17 E98FA820 638ABA9F 281326C0 78355325 E5159D32 7BE0397D
    8FB90203 010001A3 6D306B30 0F060355 1D130101 FF040530 030101FF 30180603
    551D1104 11300F82 0D436174 616C7973 74333536 302E301F 0603551D 23041830
    1680148C F7825564 79BEAD9D 69789215 E00DC4A3 A0C89E30 1D060355 1D0E0416
    04148CF7 82556479 BEAD9D69 789215E0 0DC4A3A0 C89E300D 06092A86 4886F70D
    01010405 00038181 00212CC4 466503C4 40BF9C6B 2EE75E17 37AECFD6 E45412C9
    6A2F3B6E E455C843 8DFAEEEB BDF5E2B8 694761E2 C65FB1C2 AD7CA3A6 72D5BEE8
    72086895 6E9BC8CA 302FEABC 4E089403 1DDC7E6F D45F7B74 BFE83B7D 321FA369
    975D0DCB 5A6DD224 88C5D2BA 44CA6D33 A316A9C0 9C6D249D CFE0EE9B F8BA0BE7
    354A2DA9 BAA1D598 55
    quit
    auto qos srnd4
    !
    !
    !
    errdisable recovery cause link-flap
    errdisable recovery interval 60
    !
    spanning-tree mode rapid-pvst
    spanning-tree loopguard default
    spanning-tree extend system-id
    spanning-tree backbonefast
    !
    vlan internal allocation policy ascending
    !
    !
    !
    !
    interface GigabitEthernet0/1
    description DAYORJ
    switchport mode access
    !
    interface GigabitEthernet0/2
    description REMAI
    switchport mode access
    switchport access vlan 2
    !
    interface GigabitEthernet0/3
    description REMAI
    switchport mode access
    switchport access vlan 3
    !
    interface GigabitEthernet0/4
    !
    interface GigabitEthernet0/5
    !
    interface GigabitEthernet0/6
    !
    interface GigabitEthernet0/7
    !
    interface GigabitEthernet0/8
    !
    interface GigabitEthernet0/9
    !
    interface GigabitEthernet0/10
    !
    interface GigabitEthernet0/11
    !
    interface GigabitEthernet0/12
    !
    interface GigabitEthernet0/13
    !
    interface GigabitEthernet0/14
    !
    interface GigabitEthernet0/15
    !
    interface GigabitEthernet0/16
    !
    interface GigabitEthernet0/17
    !
    interface GigabitEthernet0/18
    !
    interface GigabitEthernet0/19
    !
    interface GigabitEthernet0/20
    !
    interface GigabitEthernet0/21
    !
    interface GigabitEthernet0/22
    !
    interface GigabitEthernet0/23
    !
    interface GigabitEthernet0/24
    !
    interface GigabitEthernet0/25
    !
    interface GigabitEthernet0/26
    !
    interface GigabitEthernet0/27
    !
    interface GigabitEthernet0/28
    !
    interface Vlan1
    description DAYORJ-LAPTOP
    ip address 192.168.10.1 255.255.255.0
    !
    interface Vlan2
    description REMAI
    ip address 192.168.20.1 255.255.255.0
    !
    interface Vlan3
    description ROMMEL
    ip address 192.168.30.1 255.255.255.0
    !
    !
    ip default-gateway 192.168.0.222
    ip classless
    ip route 0.0.0.0 0.0.0.0 192.168.0.254
    ip http server
    ip http secure-server
    !
    !
    ip sla enable reaction-alerts
    !
    !
    !
    line con 0
    line vty 0 4
    password Virtual
    login
    line vty 5 15
    password Virtual
    login
    !
    end

    Catalyst3560#

  11. Blog Admin says:

    REMAI is Vlan 2 but your configured interface GigabitEthernet0/3 and assigned that to Vlan3. Change this to Vlan 2 and your hosts should communicate

  12. still the same. i can’t ping 2 host in the same vlan. please check my settings. what are other parameters missing? i know this is one simple basic configuration but i just couldn’t work it out.

    User Access Verification

    Password:
    Catalyst3560>en
    Password:
    Catalyst3560#sh ru
    Building configuration…

    Current configuration : 1824 bytes
    !
    version 12.2
    no service pad
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    !
    hostname Catalyst3560
    !
    boot-start-marker
    boot-end-marker
    !
    enable secret 5 $1$0lng$xa8PJesyVEqkSEQJgcKtN0
    enable password $1$0lJesqkSEQJg
    !
    !
    !
    no aaa new-model
    system mtu routing 1500
    !
    !
    !
    !
    !
    !
    !
    !
    spanning-tree mode pvst
    spanning-tree extend system-id
    !
    vlan internal allocation policy ascending
    !
    !
    !
    !
    interface GigabitEthernet0/1
    !
    interface GigabitEthernet0/2
    description REMAI
    switchport access vlan 2
    switchport mode access
    !
    interface GigabitEthernet0/3
    description ROMMEL
    switchport access vlan 2
    switchport mode access
    !
    interface GigabitEthernet0/4
    !
    interface GigabitEthernet0/5
    !
    interface GigabitEthernet0/6
    !
    interface GigabitEthernet0/7
    !
    interface GigabitEthernet0/8
    !
    interface GigabitEthernet0/9
    !
    interface GigabitEthernet0/10
    !
    interface GigabitEthernet0/11
    !
    interface GigabitEthernet0/12
    !
    interface GigabitEthernet0/13
    !
    interface GigabitEthernet0/14
    !
    interface GigabitEthernet0/15
    !
    interface GigabitEthernet0/16
    !
    interface GigabitEthernet0/17
    !
    interface GigabitEthernet0/18
    !
    interface GigabitEthernet0/19
    !
    interface GigabitEthernet0/20
    !
    interface GigabitEthernet0/21
    !
    interface GigabitEthernet0/22
    !
    interface GigabitEthernet0/23
    !
    interface GigabitEthernet0/24
    !
    interface GigabitEthernet0/25
    !
    interface GigabitEthernet0/26
    !
    interface GigabitEthernet0/27
    !
    interface GigabitEthernet0/28
    !
    interface Vlan1
    ip address 192.168.10.1 255.255.255.0
    !
    interface Vlan2
    ip address 192.168.20.1 255.255.255.0
    !
    interface Vlan3
    ip address 192.168.30.1 255.255.255.0
    !
    ip classless
    ip http server
    ip http secure-server
    !
    !
    ip sla enable reaction-alerts
    !
    !
    !
    line con 0
    line vty 0 4
    password Telnet
    login
    line vty 5 15
    password Telnet
    login
    !
    end

    Catalyst3560#

  13. but i both hosts can ping their SVI (192.168.20.1)
    On each host default gateway is set to its SVI. is this the way it should be?

  14. Blog Admin says:

    I assume that you have connected both hosts on Gig0/2 and Gig0/3 of the switch and you have assigned IP in the range 192.168.20.x ? is that correct? So, the gateway of these two hosts must be the SVI of the switch (192.168.20.1) and they must be able to ping each other. Maybe you have a software firewall on the hosts? (maybe disable the windows firewall if they have one).

  15. Got it working. I just allowed the ICMP echo request to be exempted from the Windows firewall. Thanks very much Blog Admin! Now my second concern is how to route intervlan using the 3560. But i’ll have to leave this point to myself. A big thank you!

  16. Hi there! need again your help. I have two vlans created namely vlan 2 and 3. both can ping each other. however, they are unable to connect to the internet. please check my configurations below to see if there is a need to change or add something. thanks.

    User Access Verification

    Password:
    Alice3560>enable
    Password:
    Alice3560#sh ru
    Building configuration…

    Current configuration : 4296 bytes
    !
    version 12.2
    no service pad
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    !
    hostname Alice3560
    !
    boot-start-marker
    boot-end-marker
    !
    enable secret 5 $1$AGZF$AC9xOFQKTz9QA57zmfsxo/
    enable password $AC9x$AGZF
    !
    !
    !
    no aaa new-model
    system mtu routing 1500
    ip routing
    !
    !
    !
    mls qos map cos-dscp 0 8 16 24 32 46 48 56
    mls qos srr-queue input bandwidth 70 30
    mls qos srr-queue input threshold 1 80 90
    mls qos srr-queue input priority-queue 2 bandwidth 30
    mls qos srr-queue input cos-map queue 1 threshold 2 3
    mls qos srr-queue input cos-map queue 1 threshold 3 6 7
    mls qos srr-queue input cos-map queue 2 threshold 1 4
    mls qos srr-queue input dscp-map queue 1 threshold 2 24
    mls qos srr-queue input dscp-map queue 1 threshold 3 48 49 50 51 52 53 54 55
    mls qos srr-queue input dscp-map queue 1 threshold 3 56 57 58 59 60 61 62 63
    mls qos srr-queue input dscp-map queue 2 threshold 3 32 33 40 41 42 43 44 45
    mls qos srr-queue input dscp-map queue 2 threshold 3 46 47
    mls qos srr-queue output cos-map queue 1 threshold 3 4 5
    mls qos srr-queue output cos-map queue 2 threshold 1 2
    mls qos srr-queue output cos-map queue 2 threshold 2 3
    mls qos srr-queue output cos-map queue 2 threshold 3 6 7
    mls qos srr-queue output cos-map queue 3 threshold 3 0
    mls qos srr-queue output cos-map queue 4 threshold 3 1
    mls qos srr-queue output dscp-map queue 1 threshold 3 32 33 40 41 42 43 44 45
    mls qos srr-queue output dscp-map queue 1 threshold 3 46 47
    mls qos srr-queue output dscp-map queue 2 threshold 1 16 17 18 19 20 21 22 23
    mls qos srr-queue output dscp-map queue 2 threshold 1 26 27 28 29 30 31 34 35
    mls qos srr-queue output dscp-map queue 2 threshold 1 36 37 38 39
    mls qos srr-queue output dscp-map queue 2 threshold 2 24
    mls qos srr-queue output dscp-map queue 2 threshold 3 48 49 50 51 52 53 54 55
    mls qos srr-queue output dscp-map queue 2 threshold 3 56 57 58 59 60 61 62 63
    mls qos srr-queue output dscp-map queue 3 threshold 3 0 1 2 3 4 5 6 7
    mls qos srr-queue output dscp-map queue 4 threshold 1 8 9 11 13 15
    mls qos srr-queue output dscp-map queue 4 threshold 2 10 12 14
    mls qos queue-set output 1 threshold 1 100 100 50 200
    mls qos queue-set output 1 threshold 2 125 125 100 400
    mls qos queue-set output 1 threshold 3 100 100 100 400
    mls qos queue-set output 1 threshold 4 60 150 50 200
    mls qos queue-set output 1 buffers 15 25 40 20
    mls qos
    !
    !
    auto qos srnd4
    !
    !
    !
    spanning-tree mode pvst
    spanning-tree extend system-id
    !
    vlan internal allocation policy ascending
    !
    !
    !
    !
    interface GigabitEthernet0/1
    !
    interface GigabitEthernet0/2
    description GEORGE
    switchport access vlan 2
    switchport mode access
    !
    interface GigabitEthernet0/3
    description JEROME
    switchport access vlan 3
    switchport mode access
    !
    interface GigabitEthernet0/4
    !
    interface GigabitEthernet0/5
    switchport trunk encapsulation dot1q
    switchport trunk native vlan 3
    switchport mode trunk
    srr-queue bandwidth share 1 30 35 5
    queue-set 2
    priority-queue out
    mls qos trust dscp
    auto qos trust
    macro description cisco-router
    spanning-tree portfast trunk
    spanning-tree bpduguard enable
    !
    interface GigabitEthernet0/6
    !
    interface GigabitEthernet0/7
    !
    interface GigabitEthernet0/8
    !
    interface GigabitEthernet0/9
    !
    interface GigabitEthernet0/10
    !
    interface GigabitEthernet0/11
    !
    interface GigabitEthernet0/12
    !
    interface GigabitEthernet0/13
    !
    interface GigabitEthernet0/14
    !
    interface GigabitEthernet0/15
    !
    interface GigabitEthernet0/16
    !
    interface GigabitEthernet0/17
    !
    interface GigabitEthernet0/18
    !
    interface GigabitEthernet0/19
    !
    interface GigabitEthernet0/20
    !
    interface GigabitEthernet0/21
    !
    interface GigabitEthernet0/22
    !
    interface GigabitEthernet0/23
    !
    interface GigabitEthernet0/24
    !
    interface GigabitEthernet0/25
    !
    interface GigabitEthernet0/26
    !
    interface GigabitEthernet0/27
    !
    interface GigabitEthernet0/28
    !
    interface Vlan1
    no ip address
    !
    interface Vlan2
    description REMOTE
    ip address 209.209.20.1 255.255.255.0
    !
    interface Vlan3
    description MIS
    ip address 209.209.30.1 255.255.255.0
    !
    ip default-gateway 192.168.0.254
    ip classless
    ip route 0.0.0.0 0.0.0.0 192.168.0.254
    ip http server
    ip http secure-server
    !
    !
    ip sla enable reaction-alerts
    !
    !
    !
    line con 0
    line vty 0 4
    password telnet
    login
    line vty 5 15
    password telnet
    login
    !
    end

    Alice3560#

  17. Blog Admin says:

    Most probably the problem is on routing. Make sure default gateway is correct and also that your default gateway has static routes pointing back to vlan2 and vlan3 subnets.

  18. thank you so much its very helpful,first time i am seeing a good nd simple way of teaching its very helpfull for beginers and experts also, the way u given the ansers for the question is great….
    once again i am giving full thanx for u its a great work…..

  19. Nicely explained. Thanks heaps. Could you kindly show me how to assign an ip address to a switch. I have no vlans on my switch yet. so only default vlan (vlan1) is there. I want to telnet this switch through a laptop (in packet tracer) and for that I need to assign this switch an ip. Could you kindly assist. Regards

  20. Blog Admin says:

    Rehan,

    You can configure IP address under Vlan1.

    Switch(config)# interface vlan 1
    Switch(config)# ip address 192.168.1.1 255.255.255.0
    Switch(config)# no shut

    Now since you don’t have any other vlans, when you connect a PC to any port of the switch you can telnet to it. Also, don’t forget to assign a password to the telnet lines (vty 0 4) and also configure an enable secret password as well.

Trackbacks

  1. [...] a previous post I explained how to configure VLANs on Cisco Switches. That was a simple scenario with just two switches connected with a trunk port and having shared [...]

  2. [...] post describes how to configure vlan in cisco switch. The example network diagram shows two Layer 2 switches connected with a trunk port and three Vlans [...]

Speak Your Mind

*