设备配置的准备工作
修改会话超时时间,设置为永不超时。
Router(config)#line console 0Router(config-line)#exec-timeout 0 0
防止控制台自动显示的信息,可以启用显示同步。
Router(config)#line console 0Router(config-line)#logging synchronous
禁用DNS查询
Router(config)#no ip domain-lookup
显示当前路由所有操作过的命令
Router#show running-config
给路由配置IP地址
Router(config)#interface fastEthernet 0/0Router(config-if)#ip address 192.168.1.1 255.255.255.0Router(config-if)#no shutdown \\开启路由接口
给交换机配置IP地址
Switch(config)#interface vlan 1Switch(config-if)#ip address 192.168.1.1 255.255.255.0Switch(config-if)#no shutdown
配置实例
路由器的f0/0与交换机的f0/1接在一起 通过PC连接设备的Console口 为设备配置IP地址 实现设备间的互通。
Router>enRouter>enableRouter#confRouter#configureRouter#configure terminalEnter configuration commands, one per line. End with CNTL/Z.Router(config)#intRouter(config)#interface fRouter(config)#interface fastEthernet 0/0Router(config-if)#ip addRouter(config-if)#ip address 192.168.1.1 255.255.255.0Router(config-if)#no shRouter(config-if)#no shutdownRouter(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>enSwitch>enableSwitch#confSwitch#configureSwitch#configure terminalEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#Switch(config)#intSwitch(config)#interface vSwitch(config)#interface vlan 1Switch(config-if)#ip addSwitch(config-if)#ip address 192.168.1.2 255.255.255.0Switch(config-if)#no sSwitch(config-if)#no shSwitch(config-if)#no shutdownSwitch(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.2Type 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/0FastEthernet0/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/24MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,reliability 255/255, txload 1/255, rxload 1/255Encapsulation ARPA, loopback not setARP type: ARPA, ARP Timeout 04:00:00,Last input 00:00:08, output 00:00:05, output hang neverLast clearing of "show interface" counters neverInput queue: 0/75/0 (size/max/drops); Total output drops: 0Queueing strategy: fifoOutput queue :0/40 (size/max)5 minute input rate 4 bits/sec, 0 packets/sec5 minute output rate 7 bits/sec, 0 packets/sec3 packets input, 384 bytes, 0 no bufferReceived 0 broadcasts, 0 runts, 0 giants, 0 throttles0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort0 input packets with dribble condition detected4 packets output, 512 bytes, 0 underruns0 output errors, 0 collisions, 1 interface resets0 babbles, 0 late collision, 0 deferred0 lost carrier, 0 no carrier--More--