在做交換機實驗的時候,可能會需要ping一個VLAN介面來做連通性測試,但VLAN中的埠必須連線裝置之後VLAN才會是UP狀態,那如何才能不連線裝置還能方便的測試連通性呢?
S4600-28P-SI(config)#vlan 200 S4600-28P-SI(config-vlan200)#sw int e1/0/5-6 Set the port Ethernet1/0/5 access vlan 200 successfully Set the port Ethernet1/0/6 access vlan 200 successfully S4600-28P-SI(config-vlan200)#int e1/0/5 S4600-28P-SI(config-if-ethernet1/0/5)#loopback //此處,將VLAN中的某個埠配置為loopback埠,使其永久UP S4600-28P-SI(config-if-ethernet1/0/5)# %Jan 01 00:07:48 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet1/0/5, changed state to UP %Jan 01 00:07:49 2006 %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan200,changed state to UP S4600-28P-SI(config-if-ethernet1/0/5)#int vlan 200 S4600-28P-SI(config-if-vlan200)#ip add 192.168.200.1 255.255.255.0 S4600-28P-SI(config-if-vlan200)#sho ip int b Index Interface IP-Address Protocol 11001 Vlan1 unassigned down 11200 Vlan200 192.168.200.1 up 17500 Loopback 127.0.0.1 up
測試VLAN200介面是否可以ping通。
S4600-28P-SI#ping 192.168.200.1 Type ^c to abort. Sending 5 56-byte ICMP Echos to 192.168.200.1, timeout is 2 seconds. !!!!! //已ping通 Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms S4600-28P-SI#
可以ping通,則目的達成。
此時,觀察交換機埠的指示燈,可以發現,即便沒接網線,其依然會神奇的亮起來。