0


网络学习-eNSP配置路由器

在这里插入图片描述

#PC1网关:192.168.1.254#PC3网关:192.168.3.254#PC4网关:192.168.4.254
# 注:路由器接口必须配置不同网段IP地址<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
#给路由器两个接口配置IP地址[Huawei]interface gigabitethernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.254 24[Huawei-GigabitEthernet0/0/0]quit
[Huawei]interface gigabitethernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.2.1 24# 显示IP配置信息[Huawei-GigabitEthernet0/0/1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.254/24     up         up        
GigabitEthernet0/0/1              192.168.2.1/24       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)#取消IP地址配置[Huawei-GigabitEthernet0/0/1]undo ip address
[Huawei-GigabitEthernet0/0/1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.254/24     up         up        
GigabitEthernet0/0/1              unassigned           up         down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)# 网关:设备通往另外一个网段的途径,一般由路由器承担# 路由器基于路由表转发数据###1.直连路由:由设备配置好IP并开启接口后自动产生
2.静态路由:由管理员手工配置,添加所需网段路由 ip route-static dest mask next-hop
3.动态路由:宣告
4.默认路由:特殊静态路由,通常用于访问外部网络  ip route-static 0.0.0.0 0 next-hop
#### 查看路由表信息[Huawei]display ip routing-table | include /24                  #过滤显示24位的路径表信息
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public         Destinations :10       Routes :10       
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
#去向1网段的数据从GigabitEthernet0/0/0传输192.168.1.0/24  Direct  00           D   192.168.1.254   GigabitEthernet0/0/0
#去向2网段的数据从GigabitEthernet0/0/1传输192.168.2.0/24  Direct  00           D   192.168.2.1     GigabitEthernet0/0/1
# 配置静态路由--192.168.1.0为要到达的网段地址,24为掩码,192.168.2.1为下一跳地址[Huawei]ip route-static 192.168.1.0 24192.168.2.1
[Huawei]display ip routing-table | include /24
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations :14       Routes :14       
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
192.168.1.0/24  Static  600          RD   192.168.2.1     GigabitEthernet0/0/1
192.168.2.0/24  Direct  00           D   192.168.2.2     GigabitEthernet0/0/1
192.168.3.0/24  Direct  00           D   192.168.3.254   GigabitEthernet0/0/0
192.168.4.0/24  Direct  00           D   192.168.4.254   GigabitEthernet0/0/2

在这里插入图片描述

接入交换机配置
#接入交换机配置<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
# 批量创建vlan[Huawei]vlan batch 23
Info: This operation may take a few seconds. Please waitfor a moment...done.
# 配置0/0/2和0/0/3口为接入链路,放行相应vlan数据[Huawei]interface ethernet 0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 2[Huawei-Ethernet0/0/2]quit
[Huawei]interface ethernet 0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 3[Huawei-Ethernet0/0/3]quit
# 配置0/0/4口为中继链路,放行所有vlan数据                   [Huawei]interface ethernet 0/0/4
[Huawei-Ethernet0/0/4]port link-type trunk
[Huawei-Ethernet0/0/4]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/4]quit
[Huawei]display vlan
The total number of vlans is :3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------
VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:Eth0/0/1(U)     Eth0/0/4(U)     Eth0/0/5(D)     Eth0/0/6(D)     
                Eth0/0/7(D)     Eth0/0/8(D)     Eth0/0/9(D)     Eth0/0/10(D)    
                Eth0/0/11(D)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)    
                Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)    
                Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)    
                GE0/0/1(D)      GE0/0/2(D)2    common  UT:Eth0/0/2(U)                                                     
             TG:Eth0/0/4(U)3    common  UT:Eth0/0/3(U)                                                     
             TG:Eth0/0/4(U)                                                     
VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------
1enable  default       enable  disable    VLAN 0001                         
2enable  default       enable  disable    VLAN 0002                         
3enable  default       enable  disable    VLAN 0003 
核心交换机配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
# 批量创建vlan[Huawei]vlan batch 2 to 4
Info: This operation may take a few seconds. Please waitfor a moment...done.
#对虚拟端口vlan1-4设置ip地址[Huawei]interface vlanif 1[Huawei-Vlanif1]ip address 192.168.1.254 24[Huawei-Vlanif1]quit
[Huawei]interface vlanif 2[Huawei-Vlanif2]ip address 192.168.2.254 24[Huawei-Vlanif2]quit
[Huawei]interface vlanif 3[Huawei-Vlanif3]ip address 192.168.3.254 24[Huawei-Vlanif3]quit
[Huawei]interface vlanif 4[Huawei-Vlanif4]ip address 192.168.4.254 24[Huawei-Vlanif4]quit
[Huawei]interface gigabitethernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei]interface gigabitethernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 4[Huawei]display ip routing-table | include /24
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public         Destinations :10       Routes :10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    192.168.1.0/24  Direct  00           D   192.168.1.254   Vlanif1
    192.168.2.0/24  Direct  00           D   192.168.2.254   Vlanif2
    192.168.3.0/24  Direct  00           D   192.168.3.254   Vlanif3
    192.168.4.0/24  Direct  00           D   192.168.4.254   Vlanif4
[Huawei]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
MEth0/0/1                         unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           192.168.1.254/24     up         up        
Vlanif2                           192.168.2.254/24     up         up        
Vlanif3                           192.168.3.254/24     up         up        
Vlanif4                           192.168.4.254/24     up         up        
#配置动态路由[Huawei]ospf
#定义一个区域[Huawei-ospf-1]area 0#宣告自身直连的网段,配置时使用反掩码[Huawei-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255            
[Huawei-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
路由器配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]interface gigabitethernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.4.1 24[Huawei-GigabitEthernet0/0/0]quit
[Huawei]interface gigabitethernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.5.254 24[Huawei-GigabitEthernet0/0/1]quit
[Huawei]display ip routing-table | include /24
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public         Destinations :10       Routes :10       
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
192.168.4.0/24  Direct  00           D   192.168.4.1     GigabitEthernet0/0/0
192.168.5.0/24  Direct  00           D   192.168.5.254   GigabitEthernet0/0/1
#配置动态路由[Huawei]ospf
[Huawei-ospf-1]area 0#宣告自身直连的网段,配置时使用反掩码[Huawei-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[Huawei-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
#查看当前配置信息[Huawei-ospf-1]display this
[V200R003C00]#
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 
#
标签: 网络 学习

本文转载自: https://blog.csdn.net/xuwenpeng/article/details/141970040
版权归原作者 丢爸 所有, 如有侵权,请联系我们删除。

“网络学习-eNSP配置路由器”的评论:

还没有评论