交换机基本配置

一、交换机基本配置

• 配置交换机主机名。
• 禁用 DNS 查找。
• 配置默认网关。
• 配置执行模式口令class。
• 为控制台连接配置口令cisco。
• 为 vty 连接配置口令cisco。

  • 基本配置

    hostname Sw
    no ip domain-lookup
    ip default-gateway 127.17.10.1
    en se class
    配置MOTD登录标语
    ban motd #
    message
    #
    
    为控制台连接配置口令cisco
    line con 0
    password cisco
    login
    exit
    为 vty 连接配置口令cisco
    lin vty 0 15
    password cisco
    login
    exit
    
    service password-encryption  加密所有口令 (service p)
    no service password-encryption 取消加密
    
  • 管理接口配置

    en 
    conf t
    inter vlan 99
    ip addr 172.17.99.11 255.255.255.0
    no shut
    end
    
    conf t
    inter fa0/18
    sw mode access
    sw access vlan 99
    end 
    
    cop r s
    
    本征vlan 
    S1(config)#interface range fa0/1-5
    S1(config-if-range)#switchport mode trunk
    S1(config-if-range)#switchport trunk native vlan 99
    S1(config-if-range)#no shutdown
    S1(config-if-range)#end
    
    
  • 查看MAC表

    show mac-address-table(show mac-)
    clear mac-address-table 
    
  • 配置端口安全性

    将交换机端口 Fast Ethernet 0/18 配置为只接受两台设备,以动态获取这些设备的 MAC 地址,并且在发生违规时拦截来自无效主机的流量。
    S1(config-if)#switchport mode access
    S1(config-if)#switchport port-security
    S1(config-if)#switchport port-security maximum 1
    S1(config-if)#switchport port-security mac-address sticky
    S1(config-if)#switchport port-security violation protect
    S1(config-if)#exit
    
    inter fa0/18
    sw port max 1
    sw port mac s
    sw port v p
    
    
    

二、VLAN 间的路由

1. 传统路由

拓扑图

image-20201223162634217

  • 交换机配置

    interface FastEthernet0/4
     switchport access vlan 10
     switchport mode access
     
    interface FastEthernet0/11
     switchport access vlan 10
     switchport mode access
     
    interface FastEthernet0/5
     switchport access vlan 30
     switchport mode access
     
    interface FastEthernet0/6
     switchport access vlan 30
     switchport mode access
    
  • 路由器配置

    interface FastEthernet0/0
     ip address 172.17.10.1 255.255.255.0
    interface FastEthernet0/1
     ip address 172.17.30.1 255.255.255.0
    
  • pc ip&默认网关设置

    image-20201223163437331

image-20201223163455973

2. 单臂路由

拓扑图

image-20201223163805149

  • 交换机配置

    interface FastEthernet0/5
     switchport mode trunk
    
    interface FastEthernet0/6
     switchport access vlan 30
     switchport mode access
     
    interface FastEthernet0/11
     switchport access vlan 10
     switchport mode access
     
    interface FastEthernet0/18
     switchport access vlan 20
     switchport mode access
    
  • 路由器配置

    interface FastEthernet0/0.10  
    encapsulation dot1Q 10               
     ip address 172.17.10.1 255.255.255.0
    
    interface FastEthernet0/0.20
     encapsulation dot1Q 20
     ip address 172.17.20.1 255.255.255.0
    
    interface FastEthernet0/0.30
     encapsulation dot1Q 30
     ip address 172.17.30.1 255.255.255.0
    
    单臂路由配置
    路由器
    inter  fa0/0.10
    en d 10
    ip addr 172.1710.1 255.255.255.0
    
    inter fa0/0.20
    en d 20
    ip addr 172.17.20.1 255.255.255.0
    
    inter fa0/0.30
    en d 30
    ip addr 172.17.30.1 255.255.255.0
    
    inter fa0/0
    no shut 
    
    交换机
    
    vlan 10
    vlan 20
    vlan 30
    
    inter fa0/11
    sw mode access
    sw access vlan 10
    
    inter fa0/18
    sw mode access
    sw access vlan 20
    
    inter fa0/6
    sw mode access
    sw access vlan 30
    
    inter fa0/5
    sw mode trunk
    
    管理vlan设置
    
    inter vlan 99
    ip addr 172.17.99.11 255.255.255.0
    no shut 
    
    inter range fa0/1-5
    sw mode access
    sw access vlan 99
    
    本征vlan设置
    
    inter fa0/1
    sw mode trunk
    sw trunk native vlan 99
    
    
    

    测试:vlan10(CopyPC2)->vlan20(pc4)

image-20201223164529234

S1(config)#vtp mode server
S1(config)#vtp domain Lab6
S1(config)#vtp password cisco
S1(config)#end

S2(config)#vtp mode client
S2(config)#vtp domain Lab6
S1(config)#vtp password cisco
S1(config)#end

  • 16
    点赞
  • 154
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值