LAB環境(Package Tracer):
一台Router(2811)
一台Switch(2960)
三台PC
啟動Package Tracer,直接將設備拖曳出來,不必增加模組,連接線使用straight cable(黑實線)
2811的Fa 0/0連接到2960的Fa 0/1,PC2連接到Fa 0/2, PC1連接到Fa 0/3,PC0連接到Fa 0/4
2811設定:設定Fa0/0的IP
滑鼠點擊2811 >> 點擊CLI
Router> enable
Router# configure terminal
Router# interface fastEthernet 0/0
Router# #ip address 192.168.1.254 255.255.255.0
2960設定:設定Gateway及VLAN 1的IP
滑鼠點擊2960 >> 點擊CLI
Switch> enable
Switch#configure terminal
Switch#interface vlan 1
Switch#ip address 192.168.1.100 255.255.255.0
Switch#exit
Switch#ip default-gateway 192.168.1.254
PC設定:設定PC0到PC2的Gateway及IP
滑鼠點擊PC >> 點擊Desktop >> 點擊左上方的IP Configuration
設定PC的IP Address、Subnet Mask、Default Gateway
PC0:
IP Address:192.168.1.10
Subnet Mask:255.255.255.0
Default Gateway:192.168.1.254
PC1:
IP Address:192.168.1.11
Subnet Mask:255.255.255.0
Default Gateway:192.168.1.254
PC2:
IP Address:192.168.1.12
Subnet Mask:255.255.255.0
Default Gateway:192.168.1.254
環境建置完畢,接下來開始LAB:
假設人在設備旁邊,只知道哪一port有接線,不知道哪條線連接到甚麼設備上,
當前目標為找出三台PC的連接Port,已知項目為三台PC的IP
進入Router(2811)查詢:
1.先ping 目標,以便取得回應資料
Router> enable
Router#ping 192.168.1.10
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/1/3 ms
Router#ping 192.168.1.11
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.11, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/3 ms
Router#ping 192.168.1.12
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.12, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/1/3 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/1/3 ms
Router#ping 192.168.1.11
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.11, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/3 ms
Router#ping 192.168.1.12
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.12, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/1/3 ms
2. 從arp table檢視剛剛ping的三個IP,可以確認到各IP對應的mac位址
Router#show ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.10 8 0001.6479.213E ARPA FastEthernet0/0
Internet 192.168.1.11 8 00E0.8F72.0B42 ARPA FastEthernet0/0
Internet 192.168.1.12 8 0001.C705.D642 ARPA FastEthernet0/0
Internet 192.168.1.254 - 000B.BEDD.CB01 ARPA FastEthernet0/0
3.進入Switch(2960)查詢:
Switch>enable
Switch#show mac-address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0001.6479.213e DYNAMIC Fa0/4
1 0001.c705.d642 DYNAMIC Fa0/2
1 000b.bedd.cb01 DYNAMIC Fa0/1
1 00e0.8f72.0b42 DYNAMIC Fa0/3
注意!若是此處查詢時,沒有出現對應的MAC位址表格,有可能是時間過太久,MAC路由表被Switch遺忘了,需要回到Router(2811)再次執行Ping的步驟,以便Switch再次建立路由表
利用這兩處的表格即可比對出特定IP的主機是連接到Switch上的哪一個Port
192.168.1.10 >> 0001.6479.213E >> Fa0/4
192.168.1.11 >> 00E0.8F72.0B42 >> Fa0/3
192.168.1.12 >> 0001.C705.D642 >> Fa0/2
依此類推,若是只知道MAC,不知道IP的情況下,也可以查詢到IP或是對應的Port。
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.10 8 0001.6479.213E ARPA FastEthernet0/0
Internet 192.168.1.11 8 00E0.8F72.0B42 ARPA FastEthernet0/0
Internet 192.168.1.12 8 0001.C705.D642 ARPA FastEthernet0/0
Internet 192.168.1.254 - 000B.BEDD.CB01 ARPA FastEthernet0/0
3.進入Switch(2960)查詢:
Switch>enable
Switch#show mac-address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0001.6479.213e DYNAMIC Fa0/4
1 0001.c705.d642 DYNAMIC Fa0/2
1 000b.bedd.cb01 DYNAMIC Fa0/1
1 00e0.8f72.0b42 DYNAMIC Fa0/3
注意!若是此處查詢時,沒有出現對應的MAC位址表格,有可能是時間過太久,MAC路由表被Switch遺忘了,需要回到Router(2811)再次執行Ping的步驟,以便Switch再次建立路由表
利用這兩處的表格即可比對出特定IP的主機是連接到Switch上的哪一個Port
192.168.1.10 >> 0001.6479.213E >> Fa0/4
192.168.1.11 >> 00E0.8F72.0B42 >> Fa0/3
192.168.1.12 >> 0001.C705.D642 >> Fa0/2
依此類推,若是只知道MAC,不知道IP的情況下,也可以查詢到IP或是對應的Port。
沒有留言:
張貼留言