zoukankan      html  css  js  c++  java
  • 交换机路由器配置

    之前一直打算写博客,总是没有开好头,最近总算有了一个方向,于是决定把以前有的资料整理一下,一是形成习惯,二是做个备份。此次更新是第一次更新,内容包括计算机网络管理的基础内容。

    交换机路由器配置,通过配置实现两边路由器到pc连通,同时,通过配置静态路由实现左边与右边区域互相通信。网络拓扑图如下:

          pc0、pc2属于vlan1,pc1、pc3属于vlan2,首先通过基础配置,实现同一vlan间相互通信,再在三层交换机配置ip routing,实现vlan1和vlan2通信,再在三层交换机和路由器上配置路由表(ospf、rip、静态路由其中一种),实现pc到路由器的通信,右边区域同理,最后在R0和R1上配置静态路由,实现两个区域的通信。

    代码:

    ##基础配置

    #ms0

    en
    conf t
    vlan 10
    vlan 20
    int vlan 10
    ip add 192.168.10.1 255.255.255.0
    int vlan 20
    ip add 192.168.20.1 255.255.255.0
    exit
    vtp mode server
    vtp domain abin
    vtp password 123
    int f0/1
    switchport trunk encapsulation dot1q
    swi mo tr
    int f0/2
    switchport trunk encapsulation dot1q
    swi mo tr
    exit
    ip routing
    int f0/3
    no switchport
    ip add 172.168.10.1 255.255.255.0
    no shut
    exit
    router ospf 1
    network 192.168.10.0 0.0.0.255 area 1
    network 192.168.20.0 0.0.0.255 area 1
    network 172.168.10.0 0.0.0.255 area 1
    exit
    ip route 0.0.0.0 0.0.0.0 172.168.10.2

    #s0

    en
    conf t
    vtp mode client
    vtp domain abin
    vtp password 123
    int f0/1
    sw mo ac
    sw ac v 10
    int f0/2
    sw mo ac
    sw ac v 20
    int f0/3
    sw mo tr

    #s1

    en
    conf t
    vtp mode client
    vtp domain abin
    vtp password 123
    int f0/1
    sw mo ac
    sw ac v 10
    int f0/2
    sw mo ac
    sw ac v 20
    int f0/3
    sw mo tr

    #r0

    en
    conf t
    int f0/0
    ip add 172.168.10.2 255.255.255.0
    no shut
    int s0/0/0
    ip add 10.1.1.1 255.255.255.0
    no shut
    exit
    router ospf 1
    network 172.168.10.0 0.0.0.255 area 1
    exit
    ip route 0.0.0.0 0.0.0.0 10.1.1.2
    

    #ms1

    en
    conf t
    vlan 30
    vlan 40
    int vlan 30
    ip add 192.168.30.1 255.255.255.0
    int vlan 40
    ip add 192.168.40.1 255.255.255.0
    exit
    vtp mode server
    vtp domain abin
    vtp password 123
    int f0/1
    switchport trunk encapsulation dot1q
    swi mo tr
    int f0/2
    switchport trunk encapsulation dot1q
    swi mo tr
    exit
    ip routing
    int f0/3
    no switchport
    ip add 172.168.20.1 255.255.255.0
    no shut
    exit
    router ospf 1
    network 192.168.30.0 0.0.0.255 area 1
    network 192.168.40.0 0.0.0.255 area 1
    network 172.168.20.0 0.0.0.255 area 1
    exit
    ip route 0.0.0.0 0.0.0.0 172.168.20.2
    

    #s2

    en
    conf t
    vtp mode client
    vtp domain abin
    vtp password 123
    int f0/1
    sw mo ac
    sw ac v 30
    int f0/2
    sw mo ac
    sw ac v 40
    int f0/3
    sw mo tr
    

    #s3

    en
    conf t
    vtp mode client
    vtp domain abin
    vtp password 123
    int f0/1
    sw mo ac
    sw ac v 30
    int f0/2
    sw mo ac
    sw ac v 40
    int f0/3
    sw mo tr
    

    #r1

    en
    conf t
    int f0/0
    ip add 172.168.20.2 255.255.255.0
    no shut
    int s0/0/0
    ip add 10.1.1.2 255.255.255.0
    no shut
    exit
    router ospf 1
    network 172.168.20.0 0.0.0.255 area 1
    exit
    ip route 0.0.0.0 0.0.0.0 10.1.1.1
    

    结果检测:

    使用ping命令通过pc0向pc6发送icmp数据包:

  • 相关阅读:
    C#规范整理·异常与自定义异常
    C#规范整理·资源管理和序列化
    C#规范整理·泛型委托事件
    C#规范整理·集合和Linq
    <抽象工厂>比<工厂方法>多了啥(区别)
    <工厂方法>比<简单工厂>多了啥(区别)
    Unable to start Ocelot because either a ReRoute or GlobalConfiguration
    MySQL服务安装
    mysql登录报错“Access denied for user 'root'@'localhost' (using password: YES”)的处理方法
    使用博客系统发生_STORAGE_WRITE_ERROR_错误
  • 原文地址:https://www.cnblogs.com/sctb/p/11954193.html
Copyright © 2011-2022 走看看