zoukankan      html  css  js  c++  java
  • Cisco 的基本配置实例之五----交换机的路由功能与DHCP 功能

    5、配置交换机的路由功能

    说明:只有在三层交换机上才有路由功能,其他的二层接入交换机要想在不同的vlan之间传送数据需要通过trunk口到核心交换机上进行完路由交换后才可以

    TEST(config)#ip routing                                  # 使能三层交换机的路由功能,默认是关闭的

    TEST(config)#ip route 0.0.0.0 0.0.0.0 172.16.0.1     

    # 配置交换机的默认路由,也就是总的出口路由。

    TEST(config)#end                                     # 退出验证一下刚才的配置

    TEST#sh ip rouet

    Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
    
           D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
    
           N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
    
           E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
    
           i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
    
           ia - IS-IS inter area, * - candidate default, U - per-user static route
    
           o - ODR, P - periodic downloaded static route
    
     
    
    Gateway of last resort is 172.16.0.1 to network 0.0.0.0
    
     
    
    C    192.168.106.0/24 is directly connected, Vlan60
    
    # 这种类型的路由——标志为“C”的路由,为静态直连路由。
    
    C    192.168.107.0/24 is directly connected, Vlan70
    
    C    192.168.104.0/24 is directly connected, Vlan40
    
    C    192.168.105.0/24 is directly connected, Vlan50
    
    C    192.168.110.0/24 is directly connected, Vlan100
    
    C    192.168.111.0/24 is directly connected, Vlan110
    
    C    192.168.108.0/24 is directly connected, Vlan80
    
         172.16.0.0/30 is subnetted, 1 subnets
    
    C       172.16.0.0 is directly connected, Vlan2
    
    C    192.168.115.0/24 is directly connected, Vlan160
    
    C    192.168.113.0/24 is directly connected, Vlan1
    
    C    192.168.112.0/24 is directly connected, Vlan120
    
    C    192.168.102.0/24 is directly connected, Vlan20
    
    C    192.168.103.0/24 is directly connected, Vlan30
    
    C    192.168.100.0/24 is directly connected, Vlan150
    
    C    192.168.101.0/24 is directly connected, Vlan10
    
    S*   0.0.0.0/0 [1/0] via 172.16.0.1                   # 为配置的默认路由

    TEST#

    6、配置交换机的DHCP功能

    TEST#sh ip int b    # 先显示一下所有的端口配置

    Interface              IP-Address      OK? Method Status                Protocol
    
    FastEthernet1          unassigned      YES NVRAM  down                  down   
    
    Vlan1                  192.168.113.254 YES NVRAM  up                    up     
    
    Vlan2                  172.16.0.2      YES NVRAM  up                    up      
    
    Vlan10                 192.168.101.254 YES NVRAM  up                    up     
    
    Vlan20                 192.168.102.254 YES NVRAM  up                    up     
    
    Vlan30                 192.168.103.254 YES NVRAM  up                    up     
    
    Vlan40                 192.168.104.254 YES NVRAM  up                    up     
    
    Vlan50                 192.168.105.254 YES NVRAM  up                    up     
    
    Vlan60                 192.168.106.254 YES NVRAM  up                    up     
    
    Vlan70                 192.168.107.254 YES NVRAM  up                    up     
    
    Vlan80                 192.168.108.254 YES NVRAM  up                    up     
    
    Vlan100                192.168.110.254 YES NVRAM  up                    up     
    
    Vlan110                192.168.111.254 YES NVRAM  up                    up     
    
    Vlan120                192.168.112.254 YES NVRAM  up                    up
    
    # 此例中我们想让vlan120提供DHCP功能    
    
    Vlan150                192.168.100.254 YES NVRAM  up                    up     
    
    Vlan160                192.168.115.254 YES NVRAM  up                    up     
    
    GigabitEthernet1/1     unassigned      YES unset  up                    up     
    
    GigabitEthernet1/2     unassigned      YES unset  down                  down   
    
    GigabitEthernet1/3     unassigned      YES unset  down                  down   
    
    GigabitEthernet1/4     unassigned      YES unset  down                  down   
    
    GigabitEthernet1/5     unassigned      YES unset  down                  down   
    
    GigabitEthernet1/6     unassigned      YES unset  down                  down   
    
    GigabitEthernet1/7     unassigned      YES unset  down                  down   
    
    GigabitEthernet1/8     unassigned      YES unset  down                  down   
    
    GigabitEthernet1/9     unassigned      YES unset  down                  down   
    
    GigabitEthernet1/10    unassigned      YES unset  down                  down   
    
    GigabitEthernet1/11    unassigned      YES unset  down                  down   
    
    GigabitEthernet1/12    unassigned      YES unset  down                  down   
    
    GigabitEthernet1/13    unassigned      YES unset  down                  down   
    
    GigabitEthernet1/14    unassigned      YES unset  down                  down   
    
    GigabitEthernet1/15    unassigned      YES unset  up                    up     
    
    GigabitEthernet1/16    unassigned      YES unset  down                  down   
    
    GigabitEthernet1/17    unassigned      YES unset  down                  down   
    
    GigabitEthernet1/18    unassigned      YES unset  down                  down   
    
    GigabitEthernet1/19    unassigned      YES unset  down                  down   
    
    GigabitEthernet1/20    unassigned      YES unset  down                  down   
    
    GigabitEthernet3/1     unassigned      YES unset  up                    up     
    
    GigabitEthernet3/2     unassigned      YES unset  up                    up     
    
    GigabitEthernet3/3     unassigned      YES unset  up                    up     
    
    GigabitEthernet3/4     unassigned      YES unset  up                    up     
    
    GigabitEthernet3/5     unassigned      YES unset  up                    up     
    
    GigabitEthernet3/6     unassigned      YES unset  up                    up     
    
    GigabitEthernet3/7     unassigned      YES unset  up                    up     
    
    GigabitEthernet3/8     unassigned      YES unset  up                    up     
    
     

    TEST#

    TEST#conf t

    Enter configuration commands, one per line.  End with CNTL/Z.

     TEST(config)#ip dhcp pool wlan                              # 配置交换机的地址池并命名

     TEST(config)#network 192.168.112.0 255.255.255.0 # 定义此地址池的网段

    TEST(config)#default-router 192.168.112.254           # 定义分发下去的地址的默认网关

    TEST(config)#dns-server 202.102.128.68 202.102.134.68       

    # 定义分发下去地址的DNS服务器,此处是2个中间用空格分隔。

    TEST(config)#ip dhcp excluded-address 192.168.112.200 192.168.112.254     

    # 定义保留的ip地址端

    TEST(dhcp-config)#end

    TEST#sh run

    ##小结一下:至此所属这个vlan的客户机就可以通过自动获取地址的方式来得到正确的ip、网关、dns等信息。

  • 相关阅读:
    React native的static propTypes
    修改react native 的工程名
    react native的flatList
    react native获取键盘高度
    git reactNativeBle
    rn踩坑记录
    docker学习3-镜像的基本使用
    docker学习2-搭建centos7-python3.6环境
    docker学习1-CentOS 7安装docker环境
    Python3数据库封装
  • 原文地址:https://www.cnblogs.com/qzqdy/p/8116844.html
Copyright © 2011-2022 走看看