- A+
所属分类:网络运维
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | <div id="reader-pageNo-1" class="reader-page-wrap"> <h2 class="p-txt">计算机命令:</h2> <p class="p-txt">PCA login: root ;使用root用户</p> <p class="p-txt">password: linux ;口令是linux</p> <p class="p-txt"># shutdown -h now ;关机</p> <p class="p-txt"># init 0 ;关机</p> <p class="p-txt"># logout</p> <p class="p-txt"># login</p> <p class="p-txt"># ifconfig ;显示IP地址</p> <p class="p-txt"># ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址</p> <p class="p-txt"># ifconfig eht0 <ip address> netmask <netmask> down ; 删除IP地址</p> <p class="p-txt"># route add 0.0.0.0 gw <ip></p> <p class="p-txt"># route del 0.0.0.0 gw <ip></p> <p class="p-txt"># route add default gw <ip> ;设置网关</p> <p class="p-txt"># route del default gw <ip> ;删除网关</p> <p class="p-txt"># route ;显示网关</p> <p class="p-txt"># ping <ip></p> <p class="p-txt"># telnet <ip> ;建立telnet之前先ping一下</p> <h2 class="p-txt">交换机基本状态:</h2> <p class="p-txt">switch: ;ROM状态, 路由器是</p> <p class="p-txt">rommon></p> <p class="p-txt">hostname> ;用户模式</p> <p class="p-txt">hostname# ;特权模式</p> <p class="p-txt">hostname(config)# ;全局配置模式</p> <p class="p-txt">hostname(config-if)# ; 接口状态</p> <h4 class="p-txt">交换机口令设置:</h4> <p class="p-txt">switch>enable ;进入特权模式</p> <p class="p-txt">switch#config terminal ;进入全局配置模式</p> <p class="p-txt">switch(config)#hostname <hostname> ;设置交换机的主机名</p> <p class="p-txt">switch(config)#enable secret xxx ;设置特权加密口令为 xxx</p> <p class="p-txt">switch(config)#enable password xxx ;设置特权非密口令为 xxx</p> <p class="p-txt">switch(config)#line console 0 ;进控制台口(Rs232)初始化</p> <p class="p-txt">switch(config-line)#line vty 0 4 ;进入虚拟终端virtual tty</p> <p class="p-txt">switch(config-line)#login ;允许登录</p> <p class="p-txt">switch(config-line)#password xx ;设置登录口令xx</p> <p class="p-txt">switch#exit ;返回命令</p> <h4 class="p-txt">交换机VLAN设置:</h4> <p class="p-txt">switch#vlan database ;进入VLAN设置</p> <p class="p-txt">switch(vlan)#vlan 2 ;建VLAN 2</p> <p class="p-txt">switch(vlan)#no vlan 2 ;删vlan 2</p> <p class="p-txt">switch(config)#int f0/1 ;进入端口1</p> <p class="p-txt">switch(config-if)#switchport access vlan 2 ;当前端口1加入VLAN 2</p> <p class="p-txt">switch(config-if)#switchport mode trunk ;设置为干线</p> <p class="p-txt">switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan</p> <p class="p-txt">switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继</p> <p class="p-txt">switch(config)#vtp domain <name> ; 设置发vtp域名</p> <p class="p-txt">switch(config)#vtp password <word></p> <p class="p-txt">switch(config)#vtp mode server</p> <p class="p-txt">switch(config)#vtp mode client</p> <h4 class="p-txt">交换机设置IP地址:</h4> <p class="p-txt">switch(config)#interface vlan1 ;进入vlan 1</p> </div> <div id="reader-pageNo-2" class="reader-page-wrap"> <p class="p-txt">switch(config-if)#ip address <IP> <mask> ;添加远程登录IP</p> <p class="p-txt">switch(config)#ip default-gateway <IP> ;添加默认网关</p> <p class="p-txt">switch#dir flash: ;查看内存</p> <h4 class="p-txt">交换机显示命令:</h4> <p class="p-txt">switch#write ;写入保存</p> <p class="p-txt">switch#show vtp</p> <p class="p-txt">switch#show run ;查看当前配置信息</p> <p class="p-txt">switch#show vlan ;看VLAN</p> <p class="p-txt">switch#show interface ;显示所有端口信息</p> <p class="p-txt">switch#show int f0/0 ;显示端口0的信息</p> <h2 class="p-txt">路由器显示命令:</h2> <p class="p-txt">router#show run ;显示运行配置</p> <p class="p-txt">router#show interface ;显示接口</p> <p class="p-txt">router#show ip route ;显示路由</p> <p class="p-txt">router#show cdp nei ;看邻居</p> <p class="p-txt">router#reload ;重新起动</p> <h4 class="p-txt">设置口令:</h4> <p class="p-txt">router>enable ;进入特权模式</p> <p class="p-txt">router#config terminal ;进入全局配置模式</p> <p class="p-txt">router(config)#hostname <hostname> ;设置交换机的主机名</p> <p class="p-txt">router(config)#enable secret xxx ;设置特权加密口令为 xxx</p> <p class="p-txt">router(config)#enable password xxx ;设置特权非密口令为 xxx</p> <p class="p-txt">router(config)#line console 0 ;进控制台口(Rs232)初始化</p> <p class="p-txt">router(config-line)#line vty 0 4 ;进入虚拟终端virtual tty</p> <p class="p-txt">router(config-line)#login ;允许登录</p> <p class="p-txt">router(config-line)#password xx ;设置登录口令xx</p> <p class="p-txt">router(config)# (Ctrl+z) ; 返回特权模式</p> <p class="p-txt">router#exit ;返回命令</p> <h4 class="p-txt">配置IP地址:</h4> <p class="p-txt">router(config)#int s0/0 ;进行串Serail接口</p> <p class="p-txt">router(config-if)#no shutdown ;起动接口</p> <p class="p-txt">router(config-if)#clock rate 64000 ;设置时钟</p> <p class="p-txt">router(config-if)#ip address 10.1.1.1 255.255.0.0 ;设置IP地址和子网掩码</p> <p class="p-txt">router(config-if)#ip add 10.1.1.2 255.255.0.0 second;</p> <p class="p-txt">router(config-if)#int f0/0.1 ; 进入子接口</p> <p class="p-txt">router(config-subif.1)#ip address <ip><netmask> ;</p> <p class="p-txt">router(config-subif.1)#encapsulation dot1q <n> ;</p> <p class="p-txt">router(config)#config-register 0x2142 ;跳过配置文件</p> <p class="p-txt">router(config)#config-register 0x2102 ;正常使用配置文件</p> <p class="p-txt">router#reload ;重新引导</p> <h4 class="p-txt">复制操作:</h4> <p class="p-txt">router#copy running-config startup-config ;存配置</p> <p class="p-txt">router#copy running-config tftp ;上载</p> <p class="p-txt">router#copy startup-config tftp</p> <p class="p-txt">router#copy tftp fl</p> </div> <div id="reader-pageNo-3" class="reader-page-wrap"> <p class="p-txt">ash: ;特权模式下升级IOS</p> <p class="p-txt">router#copy tftp startup-config ;下载配置文件到nvram</p> <h4 class="p-txt">ROM状态:</h4> <p class="p-txt">Ctrl+Break ;进入ROM监控状态</p> <p class="p-txt">rommon>confreg 0x2142 ;跳过配置,26 36 45xx</p> <p class="p-txt">rommon>confreg 0x2102 ;使用配置,恢复工作状态</p> <p class="p-txt">rommon>reset ;重新引导,等效于重开机</p> <p class="p-txt">rommon>copy xmodem:<sname> flash:<dname> ;从console升级IOS</p> <p class="p-txt">rommon>IP_ADDRESS=10.65.1.2 ;设置路由器IP</p> <p class="p-txt">rommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码</p> <p class="p-txt">rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IP</p> <p class="p-txt">rommon>TFTP_FILE=c2600.bin ;所要下载的文件</p> <p class="p-txt">rommon>tftpdnld ;ROM监控状态下升级IOS</p> <p class="p-txt">rommon>dir flash: ;查看闪存中的内容</p> <p class="p-txt">rommon>boot ;引导IOS</p> <h4 class="p-txt">静态路由:</h4> <p class="p-txt">ip route <ip-address> <subnet-mask> <gateway> 例:</p> <p class="p-txt">router(config)#ip route 10.1.0.0 255.255.0.0 10.2.1.1</p> <p class="p-txt">router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2</p> <h4 class="p-txt">动态路由:</h4> <p class="p-txt">router(config)#ip routing ;启动路由</p> <p class="p-txt">router(config)#router rip ;启动RIP路由协议。</p> <p class="p-txt">router(config-router)#network <netid> ;配置范围,有的支持all。</p> <p class="p-txt">router(config-router)#negihbor <ip-address> ;点对点 帧中继用。</p> <h4 class="p-txt">帧中继命令:</h4> <p class="p-txt">router(config)# frame-relay switching ;使能帧中继交换</p> <p class="p-txt">router(config-s0)# encapsulation frame-relay ;使能帧中继</p> <p class="p-txt">router(config-s0)# frame-relay intf-type DCE ;DCE端(需要配虚电路)</p> <p class="p-txt">router(config-s0)# frame-relay local-dlci 20 ;配置虚电路号</p> <h4 class="p-txt">基本访问控制列表:</h4> <p class="p-txt">router(config)#access-list <number> permit|deny <source ip> <wild|any></p> <p class="p-txt">router(config)#interface <interface> ;default: deny any</p> <p class="p-txt">router(config-if)#ip access-group <number> in|out ;default: out</p> <p class="p-txt">例:</p> <p class="p-txt">RB(config)#access-list 4 permit 10.8.1.1</p> <p class="p-txt">RB(config)#access-list 4 deny 10.8.1.0 0.0.0.255</p> <p class="p-txt">RB(config)#access-list 4 permit 10.8.0.0 0.0.255.255</p> <p class="p-txt">RB(config)#access-list 4 deny 10.0.0.0 0.255.255.255</p> <p class="p-txt">RB(config)#access-list 4 permit any</p> <p class="p-txt">RB(config)#int f0/0</p> <p class="p-txt">RB(config-if)#ip access-group 4 in</p> <h4 class="p-txt">扩展访问控制列表:</h4> <p class="p-txt">access-list <number> permit|deny icmp <SourceIP wild> <destinationIP</p> <p class="p-txt">wild>[type]</p> <p class="p-txt">access-list <number> permit|deny tcp <SourceIP wild> <destinationIP</p> <p class="p-txt">wild>[port]</p> <p class="p-txt">例1:</p> <p class="p-txt">router(config)#access-list 101 deny icmp any 10.64.0.2 0.0.0.0 echo</p> <p class="p-txt">router(config)#access-list 101 permit ip any any</p> <p class="p-txt">router(config)#int s0/0</p> <p class="p-txt">router(config-if)#ip access-group 101 in</p> <p class="p-txt">例2:</p> <p class="p-txt">router(config)#access-list 102 deny tcp any</p> </div> <div id="reader-pageNo-4" class="reader-page-wrap"> <p class="p-txt">10.65.0.2 0.0.0.0 eq 80</p> <p class="p-txt">router(config)#access-list 102 permit ip any any</p> <p class="p-txt">router(config)#interface s0/1</p> <p class="p-txt">router(config-if)#ip access-group 102 out</p> <p class="p-txt">router(config)#no access-list 102</p> <p class="p-txt">router(config-if)#no ip access-group 101 in</p> </div> |
- 我的微信
- 这是我的微信扫一扫
-
- 我的微信公众号
- 我的微信公众号扫一扫
-