HCIA第一课
CLI 命令行
<SW1>system-view //进入系统视图
-----------------------------------------------------------------------------------------------------
[SW1]dis interface g0/0/1
GigabitEthernet0/0/1 current state : UP
Line protocol current state : UP
Description:
Switch Port, PVID : 1, TPID : 8100(Hex), The Maximum Frame Length is 9216
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc83-0983
Last physical up time : 2021-11-09 22:34:35 UTC-08:00
Last physical down time : 2021-11-09 22:34:13 UTC-08:00
Current system time: 2021-11-09 22:47:37-08:00
Hardware address is 4c1f-cc83-0983
Last 300 seconds input rate 0 bytes/sec, 0 packets/sec
Last 300 seconds output rate 0 bytes/sec, 0 packets/sec
Input: 42721 bytes, 359 packets
Output: 476 bytes, 4 packets
Input:
Unicast: 0 packets, Multicast: 359 packets
Broadcast: 0 packets
Output:
Unicast: 0 packets, Multicast: 4 packets
Broadcast: 0 packets
Input bandwidth utilization : 0%
Output bandwidth utilization : 0%
-------------------------------------------------------------------------
修改半双工
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]
----------------------------------------
[SW1-GigabitEthernet0/0/1]duplex half
Error: Please undo negotiation auto first.
[SW1-GigabitEthernet0/0/1]undo negotiation auto
SW1-GigabitEthernet0/0/1]duplex half
Error: The port has been configed with speed 1000, please change the speed first
.
[SW1-GigabitEthernet0/0/1]
Nov 9 2021 22:39:33-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW1-GigabitEthernet0/0/1] speed ?
10 10M port speed mode
100 100M port speed mode
1000 1000M port speed mode
auto-negotiation Auto negotiation
[SW1-GigabitEthernet0/0/1] speed 10
[SW1-GigabitEthernet0/0/1]duplex half
[SW1-GigabitEthernet0/0/1]
Nov 9 2021 22:40:53-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 8, the c
hange loop count is 0, and the maximum number of records is 4095.
2.OSI参考模型和TCPIP工业模型~(初级工程师或者Helpdesk面试很常见)
一般不会按照设备来划分层次(除了物理层);按协议划分层次(2层协议;3层协议)
HUB 集线器 物理层设备
------------------------------------------------------------------------------------------------------------------------------------------------------------------
OSI参考模型 单位 内容/作用
1物理层 bit(比特位) 电气化信号/物理规律等 比特流传输
2*数据链路层 frame(帧) ppp、以太(ethernet) 控制网络层和物理层之间通信
3*网络层 Packet(包) 路由(route)或者结构化编址(IP协议) IP寻址和路由选择
4*传输层 segment(段) TCP和UDP,形成会话和表示应用 建立维护管理端到端连接
5会话层 建立、维护、管理 会话连接
6表示层 数据格式化 加密 解密
7应用层 为应用程序提供网络服务
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
TCP/IP 工业模型
网络接口层 (以太帧的 类型/长度 字段) 对应OSI 1、2
网络层(internet protocol IP 协议字段)对应OSI 3
传输层 (端口) 对应OSI 4
应用层 对应OSI5、6、7
----------------------------------------------------------------------------------------------------------------------
设备的管理概述
一个设备的几个层面:控制层面(协议)、数据转发层面(传送报文)、管理层面
常见的管理方式:
面对面的管理:console (Primary interface 权限最高)
远程管理: telnet ssh(既有业务流量又有管理流量 叫做带内管理)
专有的管理接口/网络:中高端 Mgmt 管理网络 带外管理
web管理方式(非专业人士)
终端管理软件:secure CRT xshell putty 超级终端
console 认证通过密码
会话的3个要素:
1、IP 127.0.0.1(本地环回地址)
2、协议 telnet
3、端口(2000)
<Huawei>sys //系统视图
[R1]user-interface console 0 //进入用户接口
ctrl+z
quit 退出
[Huawei-ui-console0]display users
User-Intf Delay Type Network Address AuthenStatus AuthorcmdFlag
+ 0 CON 0 00:00:00 no Username : Unspecified /+号代表当前登录端口
[Huawei-ui-console0]set authentication password cipher renzhenhua //表示设置密码为密文方式
[Huawei-ui-console0]dis th
Nov 11 2021 00:23:47-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 5, the change loop count is 0, and the maximum number of records is 4095.
#
user-interface con 0
authentication-mode password
set authentication password cipher UTM`JN8j)$(R8!3\tBM8>$e#
user-interface vty 0 4
-----------------------------------------------------
去掉密码
undo authentication-mode
MAC 地址表
交换机(路由器上大部分时间没有,如果增加了以太模块就可以有了)上的一种转发决策表
一个MAC地址在同一时刻只能从一个接口学习到
--------------------------------------------------------------------------------
[R1]ping 10.1.10.1
PING 10.1.10.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.10.1: bytes=56 Sequence=1 ttl=128 time=80 ms
Reply from 10.1.10.1: bytes=56 Sequence=2 ttl=128 time=80 ms
Reply from 10.1.10.1: bytes=56 Sequence=3 ttl=128 time=100 ms
Reply from 10.1.10.1: bytes=56 Sequence=4 ttl=128 time=60 ms
Reply from 10.1.10.1: bytes=56 Sequence=5 ttl=128 time=70 ms
--- 10.1.10.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 60/78/100 ms
[SW3]dis mac-address
MAC address table of slot 0:
-------------------------------------------------------------------------------
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
VSI/SI MAC-Tunnel
-------------------------------------------------------------------------------
5489-982d-4ed4 1 - - GE0/0/3 dynamic 0/-
00e0-fc41-5f4c 1 - - GE0/0/2 dynamic 0/-
-------------------------------------------------------------------------------
Total matching items on slot 0 displayed = 2
要注意区分MAC地址表、ARP和路由表
3、IP基础(3层),以太是2层的一部分
IPv4: 0x0800 就是代表IP协议网络
32位 (2进制)
网络部分
主机部分
MASK (掩码):0和1组成,1代表了网络部分,0代表了主机部分,常规要求:0和1是连续的(非常规要求)
/24 -11111111,11111111,11111111,00000000
主机路由1.1.1.1/32 (loop back
IP类型地址
私有地址
10.0.0.0-10.255.255.255 RFC
172.16.0.0-172.31.255.255
192.168.0.0-192.168.255.255
特殊地址
127.0.0.0-127.255.255.255 (loopback 环回地址 127.0.0.0/8
0.0.0.0 (一个终端或网络地址没有获得地址时候的地址,默认路由 0.0.0.0/0
255.255.255.255 全局广播路由
在一个网络内,有2个地址不可以分配给主机设备使用(最小地址和最大地址)
10.1.10.255/24 定向广播地址:主机位全部为1,
10.1.10.0/24网络地址
--------------------------------------
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
4.明文远程管理
telnet协议 远程管理
管理VLAN(交换机、带内管理)
步骤1、网络连通性
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 10.1.11.1 29
[R1-GigabitEthernet0/0/1]dis th
[V200R003C00]
#
interface GigabitEthernet0/0/1
ip address 10.1.11.1 255.255.255.248
[SW1]interface vlan 1 //VLAN 1是交换机的默认vlan 1 ,所有厂商都有vlan 1
[SW1-Vlanif1]ip add
[SW1-Vlanif1]ip address 10.1.11.2 29
[SW1-Vlanif1]
Nov 17 2021 22:13:53-08:00 SW1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface Vlanif1 has entered the UP state.
Nov 17 2021 22:13:55-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 7, the change loop count is 0, and the maximum number of records is 4095.
[SW1-Vlanif1]dis th
#
interface Vlanif1
ip address 10.1.11.2 255.255.255.248
#
return
[SW1-Vlanif1]ping 10.1.11.1
PING 10.1.11.1: 56 data bytes, press CTRL_C to break
Reply from 10.1.11.1: bytes=56 Sequence=1 ttl=255 time=160 ms
Reply from 10.1.11.1: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 10.1.11.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 10.1.11.1: bytes=56 Sequence=4 ttl=255 time=60 ms
Reply from 10.1.11.1: bytes=56 Sequence=5 ttl=255 time=130 ms
--- 10.1.11.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/84/160 ms
//真机开启telnet服务
[SW1]telnet server enable
Info: The Telnet server has been enabled.
//进入用户视图
[SW1]user-interface ?
INTEGER<0,34-48,50-54> The first user terminal interface to be configured
console Primary user terminal interface
current The current user terminal interface
maximum-vty The maximum number of VTY users, the default value is 5
vty The virtual user terminal interface
[SW1]user-interface vty 0 4 //尽量不要只进入0,0容易被占用
[SW1-ui-vty0-4] set authentication password simple ren //设置密码
用R1来管理SW1,R1先退出到y用户视图
<R1>telnet 10.1.11.2
Press CTRL_] to quit telnet mode
Trying 10.1.11.2 ...
Connected to 10.1.11.2 ...
回到SW1去验证
[SW1]dis users
User-Intf Delay Type Network Address AuthenStatus AuthorcmdFlag
+ 0 CON 0 00:00:00 no Username : Unspecified //当前用户
34 VTY 0 00:00:22 TEL 10.1.11.1 pass no Username : Unspecified //远程用户
浙公网安备 33010602011771号