Configuration procedure
Configuring Router A
# Configure IP addresses for interfaces. (Details not shown.)
# Configure OSPF.
<RouterA> system-view [RouterA] ospf 1 router-id 1.1.1.1 [RouterA-ospf-1] area 0 [RouterA-ospf-1-area-0.0.0.0] network 192.1.1.0 0.0.0.255 [RouterA-ospf-1-area-0.0.0.0] quit [RouterA-ospf-1] quit
# Create a keychain named abc, and specify the absolute time mode for it.
[RouterA] keychain abc mode absolute
# Create key 1 for the keychain abc, specify an authentication algorithm, and configure a key string and the sending and receiving lifetimes for the key.
[RouterA-keychain-abc] key 1 [RouterA-keychain-abc-key-1] authentication-algorithm md5 [RouterA-keychain-abc-key-1] key-string plain 123456 [RouterA-keychain-abc-key-1] send-lifetime utc 10:00:00 2015/02/06 to 11:00:00 2015/02/06 [RouterA-keychain-abc-key-1] accept-lifetime utc 10:00:00 2015/02/06 to 11:00:00 2015/02/06 [RouterA-keychain-abc-key-1] quit
# Create key 2 for the keychain abc, specify an authentication algorithm, and configure a key string and the sending and receiving lifetimes for the key.
[RouterA-keychain-abc] key 2 [RouterA-keychain-abc-key-2] authentication-algorithm hmac-md5 [RouterA-keychain-abc-key-2] key-string plain pwd123 [RouterA-keychain-abc-key-2] send-lifetime utc 11:00:00 2015/02/06 to 12:00:00 2015/02/06 [RouterA-keychain-abc-key-2] accept-lifetime utc 11:00:00 2015/02/06 to 12:00:00 2015/02/06 [RouterA-keychain-abc-key-2] quit [RouterA-keychain-abc] quit
# Configure GigabitEthernet 1/0/1 to use the keychain abc for authentication.
[RouterA] interface GigabitEthernet 1/0/1 [RouterA-GigabitEthernet1/0/1] ospf authentication-mode keychain abc
[RouterA-GigabitEthernet1/0/1] quit
Configuring Router B
# Configure IP addresses for interfaces. (Details not shown.)
# Configure OSPF.
<RouterB> system-view [RouterB] ospf 1 router-id 2.2.2.2 [RouterB-ospf-1] area 0 [RouterB-ospf-1-area-0.0.0.0] network 192.1.1.0 0.0.0.255 [RouterB-ospf-1-area-0.0.0.0] quit [RouterB-ospf-1] quit
# Create a keychain named abc, and specify the absolute time mode for it.
[RouterB] keychain abc mode absolute
# Create key 1 for the keychain abc, specify an authentication algorithm, and configure a key string and the sending and receiving lifetimes for the key.
[RouterB-keychain-abc] key 1 [RouterB-keychain-abc-key-1] authentication-algorithm md5 [RouterB-keychain-abc-key-1] key-string plain 123456 [RouterB-keychain-abc-key-1] send-lifetime utc 10:00:00 2015/02/06 to 11:00:00 2015/02/06 [RouterB-keychain-abc-key-1] accept-lifetime utc 10:00:00 2015/02/06 to 11:10:00 2015/02/06 [RouterB-keychain-abc-key-1] quit
# Create key 2 for the keychain abc, specify an authentication algorithm, and configure a key string and the sending and receiving lifetimes for the key.
[RouterB-keychain-abc] key 2 [RouterB-keychain-abc-key-2] key-string plain pwd123 [RouterB-keychain-abc-key-2] authentication-algorithm hmac-md5 [RouterB-keychain-abc-key-2] send-lifetime utc 11:00:00 2015/02/06 to 12:00:00 2015/02/06 [RouterB-keychain-abc-key-2] accept-lifetime utc 11:00:00 2015/02/06 to 12:00:00 2015/02/06 [RouterB-keychain-abc-key-2] quit [RouterB-keychain-abc] quit
# Configure GigabitEthernet 1/0/1 to use the keychain abc for authentication.
[RouterB] interface GigabitEthernet 1/0/1 [RouterB-GigabitEthernet1/0/1] ospf authentication-mode keychain abc [RouterB-GigabitEthernet1/0/1] quit