Table of ContentsView in Frames

Specifying the prefix length for a network interface

Prefix length specifies the number of bits in the IP address that are to be used as the subnet mask. You can specify the prefix length for a network interface by using the ifconfig command.

About this task

For an IPv4 address, the prefix length must be less than or equal to 32 bits. For an IPv6 address, the prefix length must be less than or equal to 128 bits. The default value of the prefix length for an IPv6 address is 64 bits.

Step

  1. To specify the prefix length, enter the following command:
    ifconfig interface_name ip_address prefixlen length

    ip_address is the IP address assigned to the network interface.

    length is the prefix length for the network interface.

    Example

    To configure a prefix length of 24 bits, enter the following command:

    ifconfig e0a 192.0.2.16 prefixlen 24

    To configure a prefix length of 64 bits for an IPv6 address, enter the following command:

    ifconfig e3a 2001:0db8:35ab:0:8a2e:0:0370:85 prefixlen 64