Home > Articles > Inter-VLAN Routing

Inter-VLAN Routing

Chapter Description

In this sample chapter from Switching, Routing, and Wireless Essentials Companion Guide (CCNAv7) for Cisco Networking Academy students, you will learn how to troubleshoot common inter-VLAN configuration issues.

Inter-VLAN Routing using Layer 3 Switches (4.3)

In this section, you configure inter-VLAN routing using Layer 3 switches.

Layer 3 Switch Inter-VLAN Routing (4.3.1)

Modern enterprise networks rarely use router-on-a-stick because it does not scale easily to meet requirements. In these very large networks, network administrators use Layer 3 switches to configure inter-VLAN routing.

Inter-VLAN routing using the router-on-a-stick method is simple to implement for a small- to medium-sized organization. However, a large enterprise requires a faster, much more scalable method to provide inter-VLAN routing.

Enterprise campus LANs use Layer 3 switches to provide inter-VLAN routing. Layer 3 switches use hardware-based switching to achieve higher-packet processing rates than routers. Layer 3 switches are also commonly implemented in enterprise distribution layer wiring closets.

Capabilities of a Layer 3 switch include the ability to do the following:

  • Route from one VLAN to another using multiple switched virtual interfaces (SVIs).

  • Convert a Layer 2 switchport to a Layer 3 interface (that is, a routed port). A routed port is similar to a physical interface on a Cisco IOS router.

To provide inter-VLAN routing, Layer 3 switches use SVIs. SVIs are configured using the same interface vlan vlan-id command used to create the management SVI on a Layer 2 switch. A Layer 3 SVI must be created for each of the routable VLANs.

Layer 3 Switch Scenario (4.3.2)

In Figure 4-6, the Layer 3 switch, D1, is connected to two hosts on different VLANs. PC1 is in VLAN 10, and PC2 is in VLAN 20, as shown. The Layer 3 switch will provide inter-VLAN routing services to the two hosts.

FIGURE 4-6

Figure 4-6 Layer 3 Switch Inter-VLAN Routing Topology

Table 4-3 shows the IP addresses for each VLAN.

Table 4-3 D1 VLAN IP Addresses

VLAN Interface

IP Address

10

192.168.10.1/24

20

192.168.20.1/24

Layer 3 Switch Configuration (4.3.3)

Complete the following steps to configure S1 with VLANs and trunking:

howto.jpg
  • Step 1. Create the VLANs. First, create the two VLANs as shown in Example 4-13.

    Example 4-13 Create the VLANs

    D1(config)# vlan 10
    D1(config-vlan)# name LAN10
    D1(config-vlan)# vlan 20
    D1(config-vlan)# name LAN20
    D1(config-vlan)# exit
    D1(config)#
  • Step 2. Create the SVI VLAN interfaces. Configure the SVI for VLANs 10 and 20, as shown in Example 4-14. The IP addresses that are configured will serve as the default gateways to the hosts in the respective VLANs. Notice the informational messages showing the line protocol on both SVIs changed to up.

    Example 4-14 Create the SVI VLAN Interfaces

    D1(config)# interface vlan 10
    D1(config-if)# description Default Gateway SVI for 192.168.10.0/24
    D1(config-if)# ip add 192.168.10.1 255.255.255.0
    D1(config-if)# no shut
    D1(config-if)# exit
    D1(config)#
    D1(config)# int vlan 20
    D1(config-if)# description Default Gateway SVI for 192.168.20.0/24
    D1(config-if)# ip add 192.168.20.1 255.255.255.0
    D1(config-if)# no shut
    D1(config-if)# exit
    D1(config)#
    *Sep 17 13:52:16.053: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10,
      changed state to up
    *Sep 17 13:52:16.160: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20,
      changed state to up
  • Step 3. Configure access ports. Next, configure the access ports connecting to the hosts and assign them to their respective VLANs, as shown in Example 4-15.

    Example 4-15 Configure Access Ports

    D1(config)# interface GigabitEthernet1/0/6
    D1(config-if)# description Access port to PC1
    D1(config-if)# switchport mode access
    D1(config-if)# switchport access vlan 10
    D1(config-if)# exit
    D1(config)#
    D1(config)# interface GigabitEthernet1/0/18
    D1(config-if)# description Access port to PC2
    D1(config-if)# switchport mode access
    D1(config-if)# switchport access vlan 20
    D1(config-if)# exit
  • Step 4. Enable IP routing. Finally, enable IPv4 routing with the ip routing global configuration command to allow traffic to be exchanged between VLANs 10 and 20, as shown in Example 4-16. This command must be configured to enable inter-VAN routing on a Layer 3 switch for IPv4.

    Example 4-16 Enable IP Routing

    D1(config)# ip routing
    D1(config)#

Layer 3 Switch Inter-VLAN Routing Verification (4.3.4)

Inter-VLAN routing using a Layer 3 switch is simpler to configure than the router-on-a-stick method. After the configuration is complete, the configuration can be verified by testing connectivity between the hosts.

From a host, verify connectivity to a host in another VLAN using the ping command. It is a good idea to first verify the current host IP configuration using the ipconfig Windows host command. The output in Example 4-17 confirms the IPv4 address and default gateway of PC1.

Example 4-17 Verify Windows Host Configuration

C:\Users\PC1> ipconfig
Windows IP Configuration
Ethernet adapter Ethernet0:
  Connection-specific DNS Suffix .   :
  Link-local IPv6 Address            : fe80::5c43:ee7c:2959:da68%6
  IPv4 Address                       : 192.168.10.10
  Subnet Mask                        : 255.255.255.0
  Default Gateway                    : 192.168.10.1
C:\Users\PC1>

Next, verify connectivity with PC2 using the ping Windows host command, as shown in Example 4-18. The ping output successfully confirms that inter-VLAN routing is operating.

Example 4-18 Verify Inter-VLAN Routing by Pinging from PC1

C:\Users\PC1> ping 192.168.20.10
Pinging 192.168.20.10 with 32 bytes of data:
Reply from 192.168.20.10: bytes=32 time<1ms TTL=127
Reply from 192.168.20.10: bytes=32 time<1ms TTL=127
Reply from 192.168.20.10: bytes=32 time<1ms TTL=127
Reply from 192.168.20.10: bytes=32 time<1ms TTL=127
Ping statistics for 192.168.20.10:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\Users\PC1>

Routing on a Layer 3 Switch (4.3.5)

If VLANs are to be reachable by other Layer 3 devices, they must be advertised using static or dynamic routing. To enable routing on a Layer 3 switch, a routed port must be configured.

A routed port is created on a Layer 3 switch by disabling the switchport feature on a Layer 2 port that is connected to another Layer 3 device. Specifically, configuring the no switchport interface configuration command on a Layer 2 port converts it into a Layer 3 interface. Then the interface can be configured with an IPv4 configuration to connect to a router or another Layer 3 switch.

Routing Scenario on a Layer 3 Switch (4.3.6)

In Figure 4-7, the previously configured D1 Layer 3 switch is now connected to R1. R1 and D1 are both in an Open Shortest Path First (OSPF) routing protocol domain. Assume inter-VLAN has been successfully implemented on D1. The G0/0/1 interface of R1 has also been configured and enabled. Additionally, R1 is using OSPF to advertise its two networks, 10.10.10.0/24 and 10.20.20.0/24.

FIGURE 4-7

Figure 4-7 Routing Scenario on a Layer 3 Switch Topology

Routing Configuration on a Layer 3 Switch (4.3.7)

Complete the following steps to configure D1 to route with R1:

howto.jpg
  • Step 1. Configure the routed port. Configure G1/0/1 to be a routed port, assign it an IPv4 address, and enable it, as shown in Example 4-19.

    Example 4-19 Configure the Routed Port

    D1(config)# interface GigabitEthernet1/0/1
    D1(config-if)# description routed Port Link to R1
    D1(config-if)# no switchport
    D1(config-if)# ip address 10.10.10.2 255.255.255.0
    D1(config-if)# no shut
    D1(config-if)# exit
    D1(config)#
  • Step 2. Enable routing, as shown in Example 4-20. Ensure IPv4 routing is enabled with the ip routing global configuration command.

    Example 4-20 Enable Routing

    D1(config)# ip routing
    D1(config)#
  • Step 3. Configure routing. Configure the OSPF routing protocol to advertise the VLAN 10 and VLAN 20 networks, along with the network that is connected to R1, as shown in Example 4-21. Notice the message informing you that an adjacency has been established with R1.

    Example 4-21 Configure Routing

    D1(config)# router ospf 10
    D1(config-router)# network 192.168.10.0 0.0.0.255 area 0
    D1(config-router)# network 192.168.20.0 0.0.0.255 area 0
    D1(config-router)# network 10.10.10.0 0.0.0.3 area 0
    D1(config-router)# ^Z
    D1#
    *Sep 17 13:52:51.163: %OSPF-5-ADJCHG: Process 10, Nbr 10.20.20.1 on
      GigabitEthernet1/0/1 from LOADING to FULL, Loading Done
    D1#
  • Step 4. Verify routing. Verify the routing table on D1, as shown in Example 4-22. Notice that D1 now has a route to the 10.20.20.0/24 network.

    Example 4-22 Verify Routing

    D1# show ip route | begin Gateway
    Gateway of last resort is not set
          10.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
    C        10.10.10.0/30 is directly connected, GigabitEthernet1/0/1
    L        10.10.10.2/32 is directly connected, GigabitEthernet1/0/1
    O        10.20.20.0/24 [110/2] via 10.10.10.1, 00:00:06, GigabitEthernet1/0/1
          192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
    C        192.168.10.0/24 is directly connected, Vlan10
    L        192.168.10.1/32 is directly connected, Vlan10
          192.168.20.0/24 is variably subnetted, 2 subnets, 2 masks
    C        192.168.20.0/24 is directly connected, Vlan20
    L        192.168.20.1/32 is directly connected, Vlan20
    D1#
  • Step 5. Verify connectivity. At this time, PC1 and PC2 are able to ping the server connected to R1, as shown in Example 4-23.

    Example 4-23 Verify Connectivity

    C:\Users\PC1> ping 10.20.20.254
    Pinging 10.20.20.254 with 32 bytes of data:
    Request timed out.
    Reply from 10.20.20.254: bytes=32 time<1ms TTL=127
    Reply from 10.20.20.254: bytes=32 time<1ms TTL=127
    Reply from 10.20.20.254: bytes=32 time<1ms TTL=127
    Ping statistics for 10.20.20.254:
        Packets: Sent = 4, Received = 3, Lost = 1 (25% loss).
    Approximate round trip times in milli-seconds:
        Minimum = 1ms, Maximum = 2ms, Average = 1ms 
    C:\Users\PC1>
    !==================================================
    C:\Users\PC2> ping 10.20.20.254
    Pinging 10.20.20.254 with 32 bytes of data:
    Reply from 10.20.20.254: bytes=32 time<1ms TTL=127
    Reply from 10.20.20.254: bytes=32 time<1ms TTL=127
    Reply from 10.20.20.254: bytes=32 time<1ms TTL=127
    Reply from 10.20.20.254: bytes=32 time<1ms TTL=127
    Ping statistics for 10.20.20.254:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss).
    Approximate round trip times in milli-seconds:
        Minimum = 1ms, Maximum = 2ms, Average = 1ms
    C:\Users\PC2>
7. Troubleshoot Inter-VLAN Routing (4.4) | Next Section Previous Section

Cisco Press Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Cisco Press and its family of brands. I can unsubscribe at any time.

Overview

Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Cisco Press products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@ciscopress.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security

Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children

This site is not directed to children under the age of 13.

Marketing

Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out

Users can always make an informed choice as to whether they should proceed with certain services offered by Cisco Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.ciscopress.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links

This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020