Assign an IP Address to a VLAN

Assign an IP address to a VLAN so that it supports routing operations.

Before you begin

  • You must create the VLAN.

  • Activate IP forwarding globally.

About this task

If an IP interface is configured without specifying the VRF instance, it maps to VRF 0 by default.

Use the vrf parameter to associate the VLAN with a VRF instance.

Important

Important

The VRRP virtual IP address cannot be same as the local IP address of the port or VLAN on which VRRP is enabled.

Procedure

  1. Enter VLAN Interface Configuration mode:

    enable

    configure terminal

    interface vlan <1–4059>

  2. Assign an IP address to a VLAN:

    ip address {<A.B.C.D/X>|<A.B.C.D> <A.B.C.D>} [dvr-one-ip] [name WORD <0-64>]

  3. Optional: If required, associate the VLAN with a VRF:

    vrf WORD<1–16>

Example

Switch:1>enable 
Switch:1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Switch:1(config)#interface vlan 2
Switch:1(config-if)#ip address 192.0.2.5 255.255.255.0 dvr-one-ip name Boston

Variable Definitions

The following table defines parameters for the ip address command.

Variable

Value

<A.B.C.D/X>|<A.B.C.D> <A.B.C.D>

Specifies the IP address and subnet mask in the format A.B.C.D/X or A.B.C.D A.B.C.D.

dvr-one-ip

Specifies that the IP address will be used as the DvR gateway IP address and will be used by all other DvR Controllers for the DvR VLAN subnet.

name WORD <0-64>

Specifies the name associated with the IP address on a VLAN.

This parameter does not apply to all hardware platforms.

The following table defines parameters for the vrf command.

Variable

Value

WORD<0-16>

Specifies the VRF of the VLAN.