设备配置的准备工作
修改会话超时时间,设置为永不超时。
Router(config)#line console 0 Router(config-line)#exec-timeout 0 0
防止控制台自动显示的信息,可以启用显示同步。
Router(config)#line console 0 Router(config-line)#logging synchronous
禁用DNS查询
Router(config)#no ip domain-lookup
显示当前路由所有操作过的命令
Router#show running-config
给路由配置IP地址
Router(config)#interface fastEthernet 0/0 Router(config-if)#ip address 192.168.1.1 255.255.255.0 Router(config-if)#no shutdown \\开启路由接口
给交换机配置IP地址
Switch(config)#interface vlan 1 Switch(config-if)#ip address 192.168.1.1 255.255.255.0 Switch(config-if)#no shutdown
配置实例
路由器的f0/0与交换机的f0/1接在一起 通过PC连接设备的Console口 为设备配置IP地址 实现设备间的互通。
Router>en Router>enable Router#conf Router#configure Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#int Router(config)#interface f Router(config)#interface fastEthernet 0/0 Router(config-if)#ip add Router(config-if)#ip address 192.168.1.1 255.255.255.0 Router(config-if)#no sh Router(config-if)#no shutdown Router(config-if)# %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Switch>en Switch>enable Switch#conf Switch#configure Switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# Switch(config)#int Switch(config)#interface v Switch(config)#interface vlan 1 Switch(config-if)#ip add Switch(config-if)#ip address 192.168.1.2 255.255.255.0 Switch(config-if)#no s Switch(config-if)#no sh Switch(config-if)#no shutdown Switch(config-if)# %LINK-5-CHANGED: Interface Vlan1, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
Router# Router#ping 192.168.1.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds: ..!!! Success rate is 60 percent (3/5), round-trip min/avg/max = 0/0/1 ms
出现不通情况,可以查看接口
Router#show interfaces f0/0 FastEthernet0/0 is up, line protocol is up (connected) Hardware is Lance, address is 0010.11e3.ec01 (bia 0010.11e3.ec01) Internet address is 192.168.1.1/24 MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set ARP type: ARPA, ARP Timeout 04:00:00, Last input 00:00:08, output 00:00:05, output hang never Last clearing of "show interface" counters never Input queue: 0/75/0 (size/max/drops); Total output drops: 0 Queueing strategy: fifo Output queue :0/40 (size/max) 5 minute input rate 4 bits/sec, 0 packets/sec 5 minute output rate 7 bits/sec, 0 packets/sec 3 packets input, 384 bytes, 0 no buffer Received 0 broadcasts, 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort 0 input packets with dribble condition detected 4 packets output, 512 bytes, 0 underruns 0 output errors, 0 collisions, 1 interface resets 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier --More--