The network command specifies the interface that runs OSPF and the area to which the interface belongs.
The undo network command deletes the interface that runs OSPF.
By default, an interface does not belong to any area.
network network-address wildcard-mask [ description text ]
undo network network-address wildcard-mask
Parameter | Description | Value |
---|---|---|
network-address |
Specifies the address of the network segment where the interface resides. |
The value is in dotted decimal notation. |
wildcard-mask |
Specifies the wildcard mask of an IP address, which is the reverse form of the mask of the IP address. For example, 0.0.0.255 indicates that the mask length is 24 bits. |
The value is in dotted decimal notation. |
description text |
Specifies the description of the specified OSPF network segment. |
The value is a string of 1 to 80 case-sensitive characters with spaces supported. |
Usage Scenario
After creating an OSPF process, you can run the network command to configure the network segments in an area and specify network-address and wildcard-mask to configure one or multiple interfaces in an area. To run OSPF on an interface, ensure that the primary IP address of this interface is in the network segment range specified in the network (OSPF) command. If the secondary IP address of the main interface is in the network segment range specified in this command, the main interface cannot run OSPF.
When the wildcard-mask parameter in the network command is set to all 0s, OSPF runs on the interface if its IP address is the IP address specified in the network network-address command.
Precautions
OSPF neighbor relationships cannot be established using the secondary IP addresses of interfaces.
After the network 0.0.0.0 0.0.0.0 command is configured, the device automatically changes the command to network 0.0.0.0 255.255.255.255. That is, all interfaces (including the management interface) will run OSPF. Therefore, exercise caution when configuring this command.
For the same network address wildcard-mask, the last description configured by description takes effect.
On a loopback interface, by default, OSPF advertises its IP address in the form of a 32-bit host route, independent of the mask length of the IP address on the interface.
To advertise the network segment route of a loopback interface, you need to run the ospf network-type command to set the network type to broadcast or NBMA.
# Configure the primary IP address of the interface that runs OSPF to be in the network segment of 192.168.1.0/24, set the ID of the OSPF area where the interface resides to 2, and configure the description for the network segment.
<HUAWEI> system-view
[HUAWEI] ospf 100
[HUAWEI-ospf-100] area 2
[HUAWEI-ospf-100-area-0.0.0.2] network 192.168.1.0 0.0.0.255 description this network is connected to Beijing