2013年9月10日 星期二

[記事] Cisco network basic configuration

屬於阿宅世界的技術文章,想看的再點開,切莫自誤 !




Note, you may try those steps in Cisco Packet Tracer Emulator

=========================
GOAL 1
1. create a network with a router (1.1.1.254) and a pc (1.1.1.1) (connect to each other)
2. pc can ping router
3. pc can access the router through telnet
=========================

Enter the EXEC mode of router
Router>enable

Enter the config mode
Router#config terminal

p.s if you enter the wrong command, the ios will spend a lots time to lookup , you may want to disable it by
Router(config)#no ip domain-lookup

Changing the name of router
Router(config)#hostname Router1

Config the interface witch connect to PC 1
Router1(config)#interface FastEthernet 0/0
Router1(config-if)#ip address 1.1.1.254 255.255.255.0
Router1(config-if)#no shutdown

Switch to PC console and config ip / gateway
PC > ipconfig 1.1.1.1 255.255.255.0 1.1.1.254

Try to ping router 1 from PC
PC>ping 1.1.1.254

Pinging 1.1.1.254 with 32 bytes of data:

Reply from 1.1.1.254: bytes=32 time=125ms TTL=255
Reply from 1.1.1.254: bytes=32 time=62ms TTL=255
Reply from 1.1.1.254: bytes=32 time=63ms TTL=255
Reply from 1.1.1.254: bytes=32 time=47ms TTL=255

Ping statistics for 1.1.1.254:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 47ms, Maximum = 125ms, Average = 74ms

Try to telnet to router 1 from PC
PC>telnet 1.1.1.254
Trying 1.1.1.254 ...Open

[Connection to 1.1.1.254 closed by foreign host]

Enable user to telnet to
Router1(config)#line vty 0 1
Router1(config-line)#password telnet
Router1(config-line)#login

Now, telnet to router 1 again
PC>telnet 1.1.1.254
Trying 1.1.1.254 ...Open

[Connection to 1.1.1.254 closed by foreign host]
PC>telnet 1.1.1.254
Trying 1.1.1.254 ...Open


User Access Verification

Password:
Router1>

Those changes will be recorded in the runn-config , u may check them by
Router#show running-config
Building configuration...

Current configuration : 616 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
!
!
!
!
!
!
 --More--
!
no ip domain-lookup
!
!
!
!
!
!
interface FastEthernet0/0
 ip address 1.1.1.254 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Serial0/0/0
 no ip address
 shutdown
!
interface Serial0/0/1
 no ip address
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
!
!
!
!
!
!
!
line con 0
line vty 0 1
 password telnet
 login
line vty 2 4
 login
line vty 2 4
 login
!
!
!
end

Contents in running-config will be flushed away, and only those in startup-config will be loaded into.

The startup-config will be empty by default
Router1#show startup-config
startup-config is not present

U may copy the changes from running-config to startup-config by
Router1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]


=========================
GOAL 2
1. create another network with a router (1.1.2.254) and a pc (1.1.2.1)
2. pc 2 can ping router 1
3. pc 2 can access the router 1 through telnet
=========================
Connect router 1 and 2 with proper link in the topology

Config router 2
Router>enable
Router#config terminal
Router(config)#hostname Router2
Router2(config)#interface FastEthernet 0/0
Router2(config-if)#ip address 1.1.2.254 255.255.255.0
Router2(config-if)#no shutdown

Config PC 2
PC > ipconfig 1.1.2.1 255.255.255.0 1.1.1.254

ping router 1 from pc 2
PC>ping 1.2.1.1

Pinging 1.2.1.1 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 1.2.1.1:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

Config router 1

Step 1, config the serial interface of router 1 and 2
Router1>enable
Router1#config terminal
Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#interface serial 0/0/0
Router1(config-if)#ip address 1.2.1.1 255.255.255.0

Router1(config-if)#clock rate 64000
Router1(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up

Step 2, config the routing on router 1
Router1#enable

Router1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 2 subnets
C       1.1.1.0 is directly connected, FastEthernet0/0
C       1.2.1.0 is directly connected, Serial0/0/0


Router1#config terminal
Router1(config)#ip route 1.1.2.0 255.255.255.0 1.2.1.2
or
Router1(config)#ip route 1.1.2.0 255.255.255.0 serial 0/0
or
Router1(config)#ip route 0.0.0.0 0.0.0.0 1.2.1.2  // default route

(p.s remove the ip route by )
Router1(config)#no ip route 1.1.2.0 255.255.255.0 1.2.1.2

Router1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 3 subnets
C       1.1.1.0 is directly connected, FastEthernet0/0
S       1.1.2.0 [1/0] via 1.2.1.2
C       1.2.1.0 is directly connected, Serial0/0/0

Check the configuration
Router1#show running-config
skip..
ip route 1.1.2.0 255.255.255.0 1.2.1.2
skip...

ping router 1 fom pc2 again
PC>ping 1.2.1.1

Pinging 1.2.1.1 with 32 bytes of data:

Reply from 1.2.1.1: bytes=32 time=93ms TTL=254
Reply from 1.2.1.1: bytes=32 time=94ms TTL=254
Reply from 1.2.1.1: bytes=32 time=78ms TTL=254
Reply from 1.2.1.1: bytes=32 time=93ms TTL=254

Ping statistics for 1.2.1.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 78ms, Maximum = 94ms, Average = 89ms

0 意見:

張貼留言