EdgeMAX - configurar rede OSPF

Visão geral


Os leitores aprenderão como configurar uma rede OSPF, com base em um exemplo de composto de três roteadores.

Diagrama mostrando uma rede OSPF com três roteadores.

 

Exemplo de


Configuração de R1

  • Configure o endereço IP.
ubnt@R1#set interfaces ethernet eth1 address 10.0.50.1/24
  • Configure o OSPF.
ubnt@R1#set protocols ospf parameters router-id 10.0.50.1
ubnt@R1#set protocols ospf area 0.0.0.0 network 10.0.50.0/24

 

Configuração de R2

  • Configure os endereços IP.
ubnt@R2#set interfaces ethernet eth1 address 10.0.50.2/24
ubnt@R2#set interfaces ethernet eth2 address 10.0.60.2/24
  • Configure o OSPF.
ubnt@R2#set protocols ospf parameters router-id 10.0.50.2
ubnt@R2#set protocols ospf area 0.0.0.0 network 10.0.50.0/24
ubnt@R2#set protocols ospf area 0.0.0.0 network 10.0.60.0/24

 

Configuração de R3

  • Configure o endereço IP.
ubnt@R3#set interfaces ethernet eth0 address 10.0.60.3/24
  • Configure o OSPF.
ubnt@R3#set protocols ospf parameters router-id 10.0.60.3
ubnt@R3#set protocols ospf area 0.0.0.0 network 10.0.60.0/24

Assim que isso estiver configurado, R1 aprende que essa 10.0.60.0/24 pode ser alcançado por 10.0.50.2:

ubnt@R1:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
   I - ISIS, B - BGP, > - selected route, * - FIB route
S>* 0.0.0.0/0 [210/0] via 192.168.0.1, eth5
O   10.0.50.0/24 [110/10] is directly connected, eth1, 00:00:27
C>* 10.0.50.0/24 is directly connected, eth1
O>* 10.0.60.0/24 [110/20] via 10.0.50.2, eth1, 00:00:11
C>* 127.0.0.0/8 is directly connected, lo
C>* 172.16.3.0/24 is directly connected, eth2
ubnt@R1:~$ ping 10.0.60.3
PING 10.0.60.3 (10.0.60.3) 56(84) bytes of data.
64 bytes from 10.0.60.3: icmp_req=1 ttl=63 time=18.1 ms
^C
--- 10.0.60.3 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 18.175/18.175/18.175/0.000 ms
ubnt@R1:~$ traceroute 10.0.60.3
traceroute to 10.0.60.3 (10.0.60.3), 30 hops max, 60 byte packets
1  10.0.50.2 (10.0.50.2)  0.251 ms  0.219 ms  0.175 ms
2  10.0.60.3 (10.0.60.3)  0.287 ms  0.248 ms  0.266 ms

Notas


Outros comandos úteis do OSPF:

Mostrar informações de IP para o OSPF

ubnt@R1:~$ show ip ospf
OSPF Routing Process, Router ID: 10.0.50.1
Supports only single TOS (TOS0) routes
This implementation conforms to RFC2328
RFC1583Compatibility flag is disabled
OpaqueCapability flag is disabled
Initial SPF scheduling delay 200 millisec(s)
Minimum hold time between consecutive SPFs 1000 millisec(s)
Maximum hold time between consecutive SPFs 10000 millisec(s)
Hold time multiplier is currently 1
SPF algorithm last executed 3m57s ago   
SPF timer is inactive
Refresh timer 10 secs
Number of external LSA 0. Checksum Sum 0x00000000
Number of opaque AS LSA 0. Checksum Sum 0x00000000
Number of areas attached to this router: 1
Area ID: 0.0.0.0 (Backbone)
Number of interfaces in this area: Total: 1, Active: 1
Number of fully adjacent neighbors in this area: 1
Area has no authentication
SPF algorithm executed 3 times
Number of LSA 5
Number of router LSA 3. Checksum Sum 0x0000d444
Number of network LSA 2. Checksum Sum 0x00007d31
Number of summary LSA 0. Checksum Sum 0x00000000
Number of ASBR summary LSA 0. Checksum Sum 0x00000000
Number of NSSA LSA 0. Checksum Sum 0x00000000
Number of opaque link LSA 0. Checksum Sum 0x00000000
Number of opaque area LSA 0. Checksum Sum 0x00000000

Mostrar o banco de dados IP para a rede OSPF 

ubnt@R1:~$ show ip ospf database
   OSPF Router with ID (10.0.50.1)
            Router Link States (Area 0.0.0.0)
Link ID         ADV Router       Age Seq#       CkSum  Link count
10.0.50.1       10.0.50.1        259 0x80000003 0x1f33  1
10.0.50.2       10.0.50.2        259 0x80000006 0x7131  2
10.0.60.3       10.0.60.3        279 0x80000003 0x43e0  1
            Net Link States (Area 0.0.0.0)
Link ID         ADV Router       Age Seq#       CkSum
10.0.50.2       10.0.50.2        260 0x80000001 0x283a
10.0.60.2       10.0.50.2        279 0x80000001 0x54f7
  
ubnt@R2:~$ show ip ospf neighbor
Neighbor ID     Pri State           Dead Time  Address        Interface            RXmtL RqstL DBsmL
10.0.50.1         1 Full/Backup     31.462s    10.0.50.1      eth1:10.0.50.2          0     0     0
10.0.60.3         1 Full/Backup     31.633s    10.0.60.3      eth2:10.0.60.2          0     0     0

Mostrar interface OSPF 

ubnt@R1:~$ show ip ospf interface eth1 
   eth1 is up
      ifindex 3, MTU 1500 bytes, BW 0 Kbit
      Internet Address 10.0.50.1/24, Broadcast 10.0.50.255, Area 0.0.0.0
      MTU mismatch detection:enabled
      Router ID 10.0.50.1, Network Type BROADCAST, Cost: 10
      Transmit Delay is 1 sec, State Backup, Priority 1
      Designated Router (ID) 10.0.50.2, Interface Address 10.0.50.2
      Backup Designated Router (ID) 10.0.50.1, Interface Address 10.0.50.1
      Multicast group memberships: OSPFAllRouters OSPFDesignatedRouters
      Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
         Hello due in 8.940s
      Neighbor Count is 1, Adjacent neighbor count is 1