2013年9月10日 星期二

[記事] Configuration (Cisco) Inter-VLAN Routing

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




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

Goal
day-2-all-netwrok-1

Config of Switch 1
!
interface FastEthernet0/1
 switchport mode trunk
!
interface FastEthernet0/2
 switchport access vlan 2
!
interface FastEthernet0/3
 switchport access vlan 3
!
interface FastEthernet0/4
 switchport mode trunk
!
Config of Switch 2
!
interface FastEthernet0/1
 switchport mode trunk
!
interface FastEthernet0/2
 switchport access vlan 2
!
interface FastEthernet0/3
 switchport access vlan 3
!

Config ip/gateway of PC 1
PC> ipconfig 1.1.1.1 255.255.255.0 1.1.1.254

Config ip/gateway of PC 2
PC> ipconfig 1.1.2.1 255.255.255.0 1.1.2.254

Config ip/gateway of PC 3
PC> ipconfig 1.1.1.2 255.255.255.0 1.1.1.254

Config ip/gateway of PC 4
PC> ipconfig 1.1.2.2 255.255.255.0 1.1.2.254

ping PC 3 from PC 1 (Same VLAN)
PC>ping 1.1.1.2

Pinging 1.1.1.2 with 32 bytes of data:

Reply from 1.1.1.2: bytes=32 time=62ms TTL=128
Reply from 1.1.1.2: bytes=32 time=94ms TTL=128
Reply from 1.1.1.2: bytes=32 time=93ms TTL=128
Reply from 1.1.1.2: bytes=32 time=94ms TTL=128

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


ping 1.1.1.254 from PC1
PC>ping 1.1.1.254

Pinging 1.1.1.254 with 32 bytes of data:

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

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

ping PC2 from PC 1
PC>ping 1.1.2.1

Pinging 1.1.2.1 with 32 bytes of data:

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

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

Config Router
Router>enable
Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface fastEthernet 0/0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface fastEthernet 0/0.1
Router(config-subif)#encapsulation dot1Q 2
Router(config-subif)#ip address 1.1.1.254 255.255.255.0
Router(config-subif)#exit
Router(config)#exit
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#show interfaces fastEthernet 0/0.1
FastEthernet0/0.1 is up, line protocol is up (connected)
  Hardware is PQUICC_FEC, address is 000d.bd4c.4e01 (bia 000d.bd4c.4e01)
  Internet address is 1.1.1.254/24
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation 802.1Q Virtual LAN, Vlan ID 2
  ARP type: ARPA, ARP Timeout 04:00:00,
  Last clearing of "show interface" counters never

Router#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface fastEthernet 0/0.2
Router(config-subif)#encapsulation dot1Q 3
Router(config-subif)#ip address 1.1.2.254 255.255.255.0
Router(config-subif)#exit
Router(config)#exit
Router#
%SYS-5-CONFIG_I: Configured from console by console

Router#show interfaces fastEthernet 0/0.2
FastEthernet0/0.2 is up, line protocol is up (connected)
  Hardware is PQUICC_FEC, address is 000d.bd4c.4e01 (bia 000d.bd4c.4e01)
  Internet address is 1.1.2.254/24
  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation 802.1Q Virtual LAN, Vlan ID 3
  ARP type: ARPA, ARP Timeout 04:00:00,
  Last clearing of "show interface" counters never

Check the Configuration
Router#show running-config
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
!
interface FastEthernet0/0.1
 encapsulation dot1Q 2
 ip address 1.1.1.254 255.255.255.0
!
interface FastEthernet0/0.2
 encapsulation dot1Q 3
 ip address 1.1.2.254 255.255.255.0
!

now ping gateway from pc 1 again
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=63ms TTL=255
Reply from 1.1.1.254: bytes=32 time=47ms TTL=255
Reply from 1.1.1.254: bytes=32 time=62ms 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 = 63ms, Average = 54ms

ping pc 2 (the pc in the other vlan), it should would now !
PC>ping 1.1.2.1

Pinging 1.1.2.1 with 32 bytes of data:

Reply from 1.1.2.1: bytes=32 time=125ms TTL=127
Reply from 1.1.2.1: bytes=32 time=125ms TTL=127
Reply from 1.1.2.1: bytes=32 time=125ms TTL=127
Reply from 1.1.2.1: bytes=32 time=125ms TTL=127

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

0 意見:

張貼留言