公司要上IDS,所以要在交换机上将24端口做一个镜像,映射到23口上,并将IDS接到23口。
monitor session 1 source interface Gi1/0/24
monitor session 1 destination interface Gi1/0/23
公司要上IDS,所以要在交换机上将24端口做一个镜像,映射到23口上,并将IDS接到23口。
monitor session 1 source interface Gi1/0/24
monitor session 1 destination interface Gi1/0/23
两种权限模式
user-view和system-view,退出system-view输入quit或ctrl+z
user-view可以进行的操作很小,可用的命令有:
debugging Enable system debugging functions display Display current system information ping Ping function quit Exit from current command view reboot Reset switch reset Reset operation save Save current configuration #保存当前配置到EEPROM system-view Enter the system view undo Cancel current setting
进行配置基本上都在system-view下进行,可用的命令有:
display Display current system information interface Specify the interface configuration view link-aggregation Ports aggregation mode mac-address Configure MAC address mirroring-port Specify mirroring port monitor-port Specify monitor port ping Ping function qos QOS configuration information queue-scheduler Specify queue scheduling mode and parameters quit Exit from current command view restore Restore configuration return Exit to user view super Modify super password parameters sysname Specify the host name storm-control Limit the rate of the specified packets of the switch snmp-agent Specify SNMP(Simple Network Management Protocol) configuration information undo Cancel current setting user-interface Enter user interface view vlan Configure VLAN
system-view下修改密码
super password bigadmin 这个是进入system-view及网页管理界面的密码
set authentication password admin 这个是telnet的密码
设置主机名
sysname hostnameofswitch
查看交换机运行信息
[SW4_R2_R2]display version H3C S5024P Product Version S5024P-R0109 Copyright (c) 2004-2009 Hangzhou H3C Technologies Co., Ltd. All rights Reserved. H3C S5024P uptime is 8 week(s),2 day(s),15 hour(s),17 minute(s) H3C S5024P with 17M 8051 Processor 128K bytes SDRAM 2048K bytes Flash Memory Config Register points to EEPROM Hardware Version is Ver.1.0 Bootrom Version is 100 [Subslot 0] 24 GE(4 COMBO) Hardware Version is Ver.1.0
查看聚合信息
display link-aggregation GigabitEthernet 0/21
查看学习到的mac地址
display mac-address
设置snmp-agent信息
snmp-agent community read abcdefg
h3c s5024p重置交换机
system-view下
[H3C]restore default This will restore the default configuration in the EEPROM memory Are you sure?[Y/N]y *** Restoring to default configuration... *** Restore default configuration successfully! Reboot the switch to activate the default configuration!
其他h3c交换机重置
reset saved-configuration reboot
enable -a显示当前用户可用的命令
less -N abc.txt 显示行号
ls 1>/dev/null 2>/dev/null 把标准输出和标准错误都定向到/dev/null
if [ `id -u` -ne "0" ]; then echo "ERROR: This script must be run as root." 1>&2 exit 1 fi
检查硬盘通电时间
安装 smartmontools ,包含有smartctl命令,
smartctl -A -v 9,msec24hour32 /dev/sda
-v 9,msec24hour32表示将第9行显示的标准从毫秒转为小时
结果是
9 Power_On_Hours 0x0032 100 100 000 Old_age Always – 41h+37m+34.450s
sftp使用不同于默认端口连接服务器
sftp -oPort=222 [email protected]
查看运行中的配置
show running-config
设备的型号,运行时间,固件
show version
其中
Processor board ID 或 System serial number 为设备出厂时候的序列号
show version | in uptime
uptime is 12 weeks, 3 days, 20 hours, 17 minutes
查看mac地址表
show mac address-table
查看具体的mac地址
show mac address-table address 0008.00ff.fc04
设置交换机的vlan ip信息,在configure terminal模式下
ip address 192.168.8.222 255.255.255.0 ip default-gateway 192.168.8.1
查看当前路由器的时间
show clock
查看日志信息
show log
查看接口的信息,很全,后面可以接具体的项
show interfaces
show interfaces description查看接口up or down
show interfaces status 快速查看接口
查看cdp邻居
show cdp neighbors
查看vlan信息
show vlan
设置时间
clock set 16:51:00 20 Aug 2013
查看学习到的arp表
show ip arp
过滤,类似于grep
show arp | include 0010.d1aa.0224
查看内存情况,可以看到内存有70MB
show processes memory Processor Pool Total: 73922040 Used: 26257284 Free: 47664756 I/O Pool Total: 14680064 Used: 12235212 Free: 2444852 Driver te Pool Total: 1048576 Used: 40 Free: 1048536
查看 cpu 使用情况
show processes cpu sorted CPU utilization for five seconds: 9%/0%; one minute: 9%; five minutes: 9%
输出过多时,可以不折叠
terminal length 0
清理单条arp信息
clear arp 10.10.0.249
#clear arp ? A.B.C.D IP address # 清理单条记录 counters Clear ARP counters #重置计数器 interface Clear the entire ARP cache on the interface # 清空整个arp缓存 vrf Clear entries for a VPN Routing/Forwarding instance
配置Telnet密码的过程如下.copy自:http://network.51cto.com/art/201007/212927.htm
第1步,进入全局配置模式.
Cisco# configure terminal
第2步,输入Telnet进程号,进入Line配置模式.在一台交换机和路由器上,最多可以实现16个Telnet进程,方便多个用户同时查看和管理.”0 15″表明配置所有可能的16个进程.
Cisco(config)# line vty 0 15
第3步,指定Telnet密码.Telnet密码设置要求与Enable相同.
Cisco(config)# password password
第4步,返回特权模式.
Cisco(config)# end
第5步,保存配置Telnet密码最后的修改.
Cisco# copy running-config startup-config
改主机名也在configure terminal里
hostname yourhostname
虽然大部分的操作都可以通过xencenter来操作,但是使用CLI (command line interface)命令行接口来操作会使工作精细化
查看角色列表
xe role-list
导出template
xe template-export template-uuid=be4440c9-7af6-87eb-ebe0-58dc6c11908b filename=win2003-pure.xva
导入
xe vm-import filename=CentOS55.xva sr-uuid=6b0c60bc-035a-2963-67e1-928a426efed8
虚拟机加电自动开机
首先查看虚拟机列表xe vm-list
uuid ( RO) : 3370bad3-2efa-c783-6008-0e34ggg92a0c
name-label ( RW): Windows Server 2003 (32-bit)
power-state ( RO): running
记录下来uuid,使用
xe vm-param-set uuid=3370bad3-2efa-c783-6008-0e34ggg92a0c other-config:auto_poweron=true
以下脚本是读取以空格分开的字段(weight.txt)变成以逗号分隔(weight.csv)
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author jpuyy.com
import csv
reader = csv.reader(open('weight.txt', 'rb'), delimiter=' ', quoting=csv.QUOTE_NONE)
writer = csv.writer(open('weight.csv', 'wb'))
for row in reader:
writer.writerow(row)
解决 csv 用 excel 打开乱码问题
import codecs file_obj = open(csv_name, "wb+") file_obj.write(codecs.BOM_UTF8) f = csv.writer(file_obj)