ospf多区域实例配置

需求:是pc1,pc2,pc3直接可以相互通信,ip分别pc1:192.168.1.2 pc2:192.168.3.2 pc3:192.168.5.2

 

 

ospf多区域实例配置_第1张图片

 

 LSW1配置:

首先划分vlan,vlan中配置ip,把端口划分到vlan中,给端口配置ip,ospf宣告网段,IP段是根据子网划分的,这里划分的是192.168.2.1  255.255.255.252 30位掩码

[Huawei]dis current-configuration 
#
sysname Huawei
#
vlan batch 10
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
#
interface Vlanif1
 ip address 192.168.1.1 255.255.255.0
#
interface Vlanif10
 ip address 192.168.2.1 255.255.255.252
#
interface MEth0/0/1
#
interface Ethernet0/0/1
 port link-type access
 port default vlan 10
#
interface Ethernet0/0/2
 port link-type access
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
ospf 1
 area 0.0.0.100
  network 192.168.1.0 0.0.0.255
  network 192.168.2.0 0.0.0.3
#
user-interface con 0
user-interface vty 0 4
#
return

学习到的网段

dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.1.0/24  Direct  0    0           D   192.168.1.1     Vlanif1
    192.168.1.1/32  Direct  0    0           D   127.0.0.1       Vlanif1
    192.168.2.0/30  Direct  0    0           D   192.168.2.1     Vlanif10
    192.168.2.1/32  Direct  0    0           D   127.0.0.1       Vlanif10
    192.168.2.4/30  OSPF    10   2           D   192.168.2.2     Vlanif10
    192.168.3.0/24  OSPF    10   3           D   192.168.2.2     Vlanif10
    192.168.4.0/24  OSPF    10   3           D   192.168.2.2     Vlanif10
    192.168.5.0/24  OSPF    10   4           D   192.168.2.2     Vlanif10

LSW2配置:

首先划分vlan,vlan中配置ip,把端口划分到vlan中,给端口配置ip,ospf宣告网段,IP段是根据子网划分的,这里划分的是192.168.2.4/5  255.255.255.252 30位掩码

dis current-configuration 
#
sysname Huawei
#
vlan batch 10 20
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
#
interface Vlanif1
#
interface Vlanif10
 ip address 192.168.2.2 255.255.255.252
#
interface Vlanif20
 ip address 192.168.2.5 255.255.255.252
#
interface MEth0/0/1
#
interface Ethernet0/0/1
 port link-type access
 port default vlan 20
#
interface Ethernet0/0/2
 port link-type access
 port default vlan 10
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
ospf 1
 area 0.0.0.100
  network 192.168.2.4 0.0.0.3
  network 192.168.2.0 0.0.0.255
#
user-interface con 0
user-interface vty 0 4
#
return

学习到的网段

dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.1.0/24  OSPF    10   2           D   192.168.2.1     Vlanif10
    192.168.2.0/30  Direct  0    0           D   192.168.2.2     Vlanif10
    192.168.2.2/32  Direct  0    0           D   127.0.0.1       Vlanif10
    192.168.2.4/30  Direct  0    0           D   192.168.2.5     Vlanif20
    192.168.2.5/32  Direct  0    0           D   127.0.0.1       Vlanif20
    192.168.3.0/24  OSPF    10   2           D   192.168.2.6     Vlanif20
    192.168.4.0/24  OSPF    10   2           D   192.168.2.6     Vlanif20
    192.168.5.0/24  OSPF    10   3           D   192.168.2.6     Vlanif20

CE1配置:

首先划分vlan,vlan中配置ip,把端口划分到vlan中,给端口配置ip,ospf宣告网段,IP段是根据子网划分的,这里划分的是192.168.2.6 255.255.255.252 30位掩码

[~HUAWEI]dis current-configuration 
!Software Version V800R013C00SPC560B560
!Last configuration was updated at 2019-04-02 23:57:11+00:00
#
sysname HUAWEI
#
device board 17 board-type CE-MPUB
device board 1 board-type CE-LPUE
#
vlan batch 20 30 40
#
aaa
 #
 authentication-scheme default
 #
 authorization-scheme default
 #
 accounting-scheme default
 #
 domain default
 #
 domain default_admin
#
interface Vlanif20
 ip address 192.168.2.6 255.255.255.252
#
interface Vlanif30
 ip address 192.168.3.1 255.255.255.0
#
interface Vlanif40
 ip address 192.168.4.1 255.255.255.0
#
interface MEth0/0/0
 undo shutdown
#
interface GE1/0/0
 undo shutdown
 port default vlan 30
#
interface GE1/0/1
 undo shutdown
 port default vlan 40
#
interface GE1/0/2
 undo shutdown
 port default vlan 20
#
interface NULL0
#
ospf 1
 area 0.0.0.0
  network 192.168.4.0 0.0.0.255
 area 0.0.0.100
  network 192.168.2.4 0.0.0.3
  network 192.168.3.0 0.0.0.255
#
ssh authorization-type default aaa
#
user-interface con 0
#
vm-manager
#
return

学习到的网段:

[~HUAWEI]dis ip routing-table 
Proto: Protocol        Pre: Preference
Route Flags: R - relay, D - download to fib, T - to -instance, B - black hole
 route
------------------------------------------------------------------------------
Routing Table : _public_
         Destinations : 16       Routes : 16        

Destination/Mask    Proto   Pre  Cost        Flags NextHop         Interface

      127.0.0.0/8   Direct  0    0             D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0             D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0             D   127.0.0.1       InLoopBack0
    192.168.1.0/24  OSPF    10   3             D   192.168.2.5     Vlanif20
    192.168.2.0/30  OSPF    10   2             D   192.168.2.5     Vlanif20
    192.168.2.4/30  Direct  0    0             D   192.168.2.6     Vlanif20
    192.168.2.6/32  Direct  0    0             D   127.0.0.1       Vlanif20
    192.168.2.7/32  Direct  0    0             D   127.0.0.1       Vlanif20
    192.168.3.0/24  Direct  0    0             D   192.168.3.1     Vlanif30
    192.168.3.1/32  Direct  0    0             D   127.0.0.1       Vlanif30
  192.168.3.255/32  Direct  0    0             D   127.0.0.1       Vlanif30
    192.168.4.0/24  Direct  0    0             D   192.168.4.1     Vlanif40
    192.168.4.1/32  Direct  0    0             D   127.0.0.1       Vlanif40
  192.168.4.255/32  Direct  0    0             D   127.0.0.1       Vlanif40
    192.168.5.0/24  OSPF    10   2             D   192.168.4.2     Vlanif40
255.255.255.255/32  Direct  0    0             D   127.0.0.1       InLoopBack0

CE2配置:

首先划分vlan,vlan中配置ip,把端口划分到vlan中,给端口配置ip,ospf宣告网段

[~HUAWEI-GE1/0/1]dis current-configuration 
!Software Version V800R013C00SPC560B560
!Last configuration was updated at 2019-04-02 23:52:32+00:00
#
sysname HUAWEI
#
device board 17 board-type CE-MPUB
device board 1 board-type CE-LPUE
#
vlan batch 40 50
#
aaa
 #
 authentication-scheme default
 #
 authorization-scheme default
 #
 accounting-scheme default
 #
 domain default
 #
 domain default_admin
#
interface Vlanif40
 ip address 192.168.4.2 255.255.255.0
#
interface Vlanif50
 ip address 192.168.5.1 255.255.255.0
#
interface MEth0/0/0
 undo shutdown
#
interface GE1/0/0
 undo shutdown
 port default vlan 50
#
interface GE1/0/1
 undo shutdown
 port default vlan 40
#
interface NULL0
#
ospf 1
 area 0.0.0.0
  network 192.168.4.0 0.0.0.255
  network 192.168.5.0 0.0.0.255
#
ssh authorization-type default aaa
#
user-interface con 0
#
vm-manager
#
return

学习到的网段:

[~HUAWEI-GE1/0/1]dis ip routing-table 
Proto: Protocol        Pre: Preference
Route Flags: R - relay, D - download to fib, T - to -instance, B - black hole
 route
------------------------------------------------------------------------------
Routing Table : _public_
         Destinations : 14       Routes : 14        

Destination/Mask    Proto   Pre  Cost        Flags NextHop         Interface

      127.0.0.0/8   Direct  0    0             D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0             D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0             D   127.0.0.1       InLoopBack0
    192.168.1.0/24  OSPF    10   4             D   192.168.4.1     Vlanif40
    192.168.2.0/30  OSPF    10   3             D   192.168.4.1     Vlanif40
    192.168.2.4/30  OSPF    10   2             D   192.168.4.1     Vlanif40
    192.168.3.0/24  OSPF    10   2             D   192.168.4.1     Vlanif40
    192.168.4.0/24  Direct  0    0             D   192.168.4.2     Vlanif40
    192.168.4.2/32  Direct  0    0             D   127.0.0.1       Vlanif40
  192.168.4.255/32  Direct  0    0             D   127.0.0.1       Vlanif40
    192.168.5.0/24  Direct  0    0             D   192.168.5.1     Vlanif50
    192.168.5.1/32  Direct  0    0             D   127.0.0.1       Vlanif50
  192.168.5.255/32  Direct  0    0             D   127.0.0.1       Vlanif50
255.255.255.255/32  Direct  0    0             D   127.0.0.1       InLoopBack0  

总结:

IP段是根据子网掩码划分的,如果不在同一个vlan中需要用到192.168.2.0段的话
这就要划分出互联ip,子网掩码是252的话,就是30位掩码,这样划分就是一个网
络地址一个广播地址,剩下两个为可用地址,如果不这样划分,掩码是255.255.255.0
的话,在其他vlan段中配置ip的192.168.2.0段ip的话会提示地址冲突(不同交换机)

同一设备不同的口子是直连
优先级:直连 >静态>动态

 

转载于:https://www.cnblogs.com/yinfutao/p/10646451.html

你可能感兴趣的:(ospf多区域实例配置)