当前位置:   article > 正文

华为 — 路由和交换(OSPF+VRRP+PAT+MSTP)及USG防火墙(实验案列+配置)_核心交换机ospf

核心交换机ospf

目录

一、拓扑+需求:

二、配置:

  (1)路由与交换:

——基础配置命令&相关查看命令

——接口ip的配置和子接口的配置

——相关vlan和trunk的配置

 ——接口下关闭:核心交换机关闭接口二层功能(二层变三层)

——配置vlan ip

——华为端口聚合捆绑:(按照顺序配置:)

——DHCP地址池:

——VRRP配置:

——MSTP:

——路由配置

——路由器PAT配置

(2)防火墙:

——接口配置: 

——ospf 路由处理 

——PAT转换 

——静态NAT映射 


一、拓扑+需求:

—————————————————————————————————————————————————— 

二、配置:

  (1)路由与交换:

——基础配置命令&相关查看命令

  1. <Huawei>system-view   //进入配置模式
  2. [Huawei]sysname r3    //定义主机名
  3. [Huawei]display current-configuration  //查看当前配置  show run
  4. [Huawei]display ip routing-table       //查看路由表 show ip route
  5. [Huawei]display interface brief       //查看接口UP/DOWN  show int brief
  6. [Huawei]display interface e0/0/0      //查看具体接口状态信息
  7. [Huawei]display arp all               //查看ARP映射  show ip arp
  8. [sw]display mac-address VLAN 100      //查看当前交换机MAC地址表(可以跟上具体vlan)
  9. [sw]display vlan      //查看VLAN数据库
  10. [sw3]display ip interface brief   //相当于 show ip int brief

——接口ip的配置和子接口的配置

  •  ——接口配置
  1. interface Ethernet0/0/0
  2.  description to  fw-g0/0/4  //接口描述
  3.  undo portswitch   //二层接口变成三层接口
  4.  ip address 10.1.1.1 255.255.255.0  //配置接口IP地址
  5.  undo shut                         //激活接口
  •  ——配置子接口
  1. int g0/0/0
  2.  undo shutdown
  3.  quit
  4. interface GigabitEthernet0/0/0.10  //进入子接口
  5.  vlan-type dot1q 10   //封装trunk,制定VLAN ID为VLAN10
  6.  ip address 10.1.1.10 255.255.255.0 //配置IP地址
  7.  undo shut

——相关vlan和trunk的配置

  •  ——创建vlan
  1. [~HUAWEI]vlan 10
  2. [*HUAWEI-vlan10]description caiwu //针对vlan做一个描述
  3. [*HUAWEI-vlan10]vlan 20
  4. [*HUAWEI-vlan20]quit
  5. [*HUAWEI]commit //commit)CE系列交换机,需要打commit配置才会生效
  6. [~HUAWEI]display vlan   //查看vlan
  •  ——接口划vlan
  1. [~HUAWEI]int g1/0/0
  2. [~HUAWEI-GE1/0/0]port link-type access
  3. [~HUAWEI-GE1/0/0]port default vlan 10
  4. [*HUAWEI-GE1/0/0]undo shut
  5. [*HUAWEI-GE1/0/0]quit
  •  ——接口封装trunk
  1. [*HUAWEI]int g1/0/2
  2. [~HUAWEI-GE1/0/2]undo shutdown
  3. [*HUAWEI-GE1/0/2]port link-type trunk
  4. [*HUAWEI-GE1/0/2]port trunk allow-pass vlan all //思科trunk允许所有vlan穿越,华为的默认不允许所有vlan穿越,修改一下
  5. [*HUAWEI-GE1/0/2]quit
  6. [*HUAWEI]commit //写入所配置的命令(如果没有打这个命令,默认不会生效)
  7. [*HUAWEI]display current-configuration //相当于sh run
  8. [~HUAWEI]display interface brief //查看接口up情况

 ——接口下关闭:核心交换机关闭接口二层功能(二层变三层)

  1. [~HUAWEI]int g1/0/1
  2. [~HUAWEI-GE1/0/1]undo portswitch
  3. [*HUAWEI-GE1/0/1]q
  4. [*HUAWEI]commit

——配置vlan ip

  1. <HUAWEI>save //保存配置,相当于write
  2. [*HUAWEI]int vlanif 40
  3. [*HUAWEI-Vlanif40]ip add 192.168.40.254 255.255.255.0
  4. [*HUAWEI-Vlanif40]un sh
  5. [*HUAWEI-Vlanif40]q
  6. [*HUAWEI]commit

——华为端口聚合捆绑:(按照顺序配置:)

  1. [sw1]int Eth-Trunk 1  //创建一个捆绑接口(int port-channel 1)
  2. [sw1-Eth-Trunk1]quit
  3. [sw1]int g0/0/4
  4. [sw1-GigabitEthernet0/0/4]eth-trunk 1
  5. [sw1-GigabitEthernet0/0/4]q
  6. [sw1]int g0/0/3
  7. [sw1-GigabitEthernet0/0/3]eth-trunk 1
  8. [sw1-GigabitEthernet0/0/3]q
  9. [sw1]int Eth-Trunk 1
  10. [sw1-Eth-Trunk1]port link-type trunk
  11. [sw1-Eth-Trunk1]port trunk allow-pass vlan all
  12. [sw1-Eth-Trunk1]q

——DHCP地址池:

  •  ——核心交换机
  1. [Quidway] dhcp enable //开启地址池
  2. [Quidway] ip pool 1 //配置地址池名称
  3. [Quidway-ip-pool-1] network 10.1.1.0 mask 255.255.255.128 //地址池范围
  4. [Quidway-ip-pool-1] dns-list 10.1.1.2 8.8.8.8 //DNS地址
  5. [Quidway-ip-pool-1] gateway-list 10.1.1.126 //网关
  6. [Quidway-ip-pool-1] excluded-ip-address 10.1.1.2
  7. [Quidway-ip-pool-1] excluded-ip-address 10.1.1.4
  8. [Quidway-ip-pool-1] lease day 10
  9. [Quidway-ip-pool-1] quit
  •  ——终端
  1. [Quidway] interface vlanif 10
  2. [Quidway-Vlanif10] dhcp select global //开启DHCP功能
  3. [Quidway-Vlanif10] quit

——VRRP配置:

  1. [sw1]int Vlanif 100
  2. [sw1-Vlanif100]vrrp vrid 100 virtual-ip 192.168.100.110
  3. [sw1-Vlanif100]vrrp vrid 100 priority 101
  4. [sw1-Vlanif100]vrrp vrid 100 track interface g0/0/1 reduced 50
  5. [sw1-Vlanif100]vrrp vrid 100 preempt-mode timer delay 0 //开启抢占,延迟时间为0
  6. display vrrp brief //查看

——MSTP:

  1. 相同的域,相同的实列
  2. ----定义MSTP:
  3. stp region-configuration  //进入到MSTP配置模式里面
  4.   region-name RG1 //定义域名,四台交换机必须相同
  5.   instance 1 vlan 2 to 100 //创建实列1,包含vlan 2到vlan 100
  6.  ( instance 1 vlan 5 7 12
  7.     instance 1 vlan 6
  8.   active region-configuration   //把MSTP的功能激活
  9.   quit
  •  以上交换机配置一模一样
  1.  stp instance 1 root primary
  2.  stp instance 2 root sec

——路由配置

  •  ——配置静态路由
  1. [Huawei]ip route-static 0.0.0.0 0.0.0.0 172.16.1.1 preference 1
  2. //去往任意地方下一跳为10.1.1.10.并且这个静态路由管理距离为1
  3. 华为静态路由默认管理距离为60,越小越优先
  •  ——ospf配置:
  1. ospf 100 router-id 1.1.1.1
  2.  default-route-advertise always //强制通告默认路由
  3.  silent-interface vlanif 10 //把vlan 10的网段通告出去,但是这个接口只发不受hello包
  4.  area 0
  5.   network 192.168.1.0 0.0.0.255
  6.  network 192.168.2.0 0.0.0.255
  7. [Huawei]display ospf peer brief  //查看邻居
  8. 华为域内,域间路由 管理距离:10 , 重分发的为150

——路由器PAT配置

—————————————————————————————————————————————————————— 

(2)防火墙:

  1. [FW3]firewall zone trust //g0/0/0接口默认被防火墙放进了trust,则把它从trust区域拿出来
  2. [FW3-zone-trust]undo add int g0/0/0
  3. [FW3-zone-trust]q

接口默认被划进了VPN实例,可以给它删除undo

——接口配置: 

放行接口相关服务(防火墙默认不放行):

  1. [FW3]int g1/0/1
  2. [FW3-GigabitEthernet1/0/1]service-manage all permit //放行所有
  3. [FW3-GigabitEthernet1/0/1]

防火墙zone配置

  1. [SRG]firewall zone name outside  //创建一个新的ZONE
  2. firewall zone outside //进入到zone
  3.  set priority 1
  4.  add inter GigabitEthernet0/0/0

注意:

  •  2,默认情况除了local zone之外,其他zone之间无法互相访问
  • 1,默认从FW可以ping通任何zone;从trust zone也能ping通FW的trust接口。其他情况则ping不同

——ospf 路由处理 

——PAT转换 

  •  对于这个安全策略,只是放行了一个方向,所以inside可以访问outside,Outside不能访问inside,同样DMZ也是如此

——静态NAT映射 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/327027
推荐阅读
相关标签
  

闽ICP备14008679号