zoukankan      html  css  js  c++  java
  • 交换机常用命令

    host主机名配置

    Switch#configure terminal 
    Switch(config)#hostname S1
    S1(config)#

    禁用dns查询

    Switch#configure terminal 
    Switch(config)#no ip domain-lookup

    vlan 配置

    创建vlan

    Switch(config)#vlan 2
    Switch(config-if)#end
    Switch#

    vlan ip 配置

    Switch(config)#interface vlan 2
    Switch(config-if)#ip address 192.168.2.1 255.255.255.0
    Switch(config-if)#no shutdown
    Switch(config-if)#exit
    Switch(config)#
    Switch(config)#interface vlan 3
    Switch(config-if)#ip address 192.168.3.1 255.255.255.0
    Switch(config-if)#no shutdown 
    Switch(config-if)#exit 
    Switch(config)#
    Switch(config)#end
    Switch#show ip route 
    Default gateway is not set
    
    Host               Gateway           Last Use    Total Uses  Interface
    ICMP redirect cache is empty
    Switch#

    设置接口为access模式

    设置接口为access模式,并加入vlan 10

    S1(config)#inter fastEthernet 0/10
    S1(config-if)#switchport mode access 
    S1(config-if)#switchport access vlan 10
    % Access VLAN does not exist. Creating vlan 10
    S1(config-if)#no shutdown 
    S1(config-if)#end
    S1#

    设置接口为tag vlan模式

    Switch(config)#interface fastEthernet 0/23
    Switch(config-if)#switchport trunk encapsulation dot1q 
    Switch(config-if)#switchport mode trunk 
    Switch(config-if)#exit
    Switch(config)#

    三层交换机开启路由功能

    Switch#configure terminal 
    Switch(config)#ip routing
    Switch(config)#end
    Switch#show ip route 
    Codes: C - connected, S - static, I - IGRP, 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, 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 not set
    
    C    192.168.2.0/24 is directly connected, Vlan2
    C    192.168.3.0/24 is directly connected, Vlan3
    Switch#

    网络实验工具

    参考链接

    本文首发于独立博客【路飞小站】:http://www.noofi.cn/?post=45

    长按二维码关注微信公众号【路飞学安全】,微信号【noofisec】

  • 相关阅读:
    一些文件的扩展名
    关于git,从svn转到git
    trousers--------dpkg: 处理软件包 trousers (--configure)时报错
    Ubuntu下运行DrClient以上网
    Ubuntu下的终端命令--复制文件从一个文件夹到另一个文件夹下
    VSCode放大字体的快捷键
    opessl版本过低造成的函数使用错误
    python的基本语法
    ubuntu和windows的解码方式
    ubuntu下强制删除文件夹
  • 原文地址:https://www.cnblogs.com/noofi/p/switch_cmd.html
Copyright © 2011-2022 走看看