Configuring an IP address and subnet mask on a VLAN

Use one of the following forms of the vlan command to configure an IP address and subnet mask:

  • vlan <vlan-id> ip address <ip-address>/<mask-length>

  • vlan <vlan-id> ip address <ip-address> <mask-bits>

  • vlan <vlan-id> ip address <dhcp-bootp>

You must either include the ID of the VLAN for which you are configuring IP addressing or go to the context configuration level for that VLAN. (If you are not using VLANs on the switch—that is, if the only VLAN is the default VLAN—then the VLAN ID is always "1".)

The default IP address setting for the DEFAULT_VLAN is DHCP/Bootp. On additional VLANs you create, the default IP address setting is disabled.

Examples

The following example configures IP addressing on the default VLAN with the subnet mask specified in mask bits.

switch(config)# vlan 1 ip address 10.28.227.103 255.255.255.0

The following example configures the same IP addressing as the preceding example, but specifies the subnet mask by mask length.

switch(config)# vlan 1 ip address 10.28.227.103/24