Host and IOS Commands
Summary
This topic use host and IOS commands to acquire information about the devices in a network. Start learning CCNA 200-301 for free right now!!
Table of Contents
IP Configuration on a Windows Host
If you have used any of the tools in the previous topic to verify connectivity and found that some part of your network is not working as it should, now is the time to use some commands to troubleshoot your devices. Host and IOS commands can help you determine if the problem is with the IP addressing of your devices, which is a common network problem.
Checking the IP addressing on host devices is a common practice in networking for verifying and troubleshooting end-to-end connectivity. In Windows 10, you can access the IP address details from the Network and Sharing Center, as shown in the figure, to quickly view the four important settings: address, mask, router, and DNS.
However, network administrators typically view the IP addressing information on a Windows host by issuing the ipconfig command at the command line of a Windows computer, as shown in the sample output.
C:\Users\PC-A> ipconfig Windows IP Configuration (Output omitted) Wireless LAN adapter Wi-Fi: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::a4aa:2dd1:ae2d:a75e%16 IPv4 Address. . . . . . . . . . . : 192.168.10.10 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.10.1 (Output omitted)
Use the ipconfig /all command to view the MAC address, as well as a number of details regarding the Layer 3 addressing of the device, as shown in the example output.
C:\Users\PC-A> ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : PC-A-00H20 Primary Dns Suffix . . . . . . . : cisco.com Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : cisco.com (Output omitted) Wireless LAN adapter Wi-Fi: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Intel(R) Dual Band Wireless-AC 8265 Physical Address. . . . . . . . . : F8-94-C2-E4-C5-0A DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::a4aa:2dd1:ae2d:a75e%16(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.10.10(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Lease Obtained. . . . . . . . . . : August 17, 2019 1:20:17 PM Lease Expires . . . . . . . . . . : August 18, 2019 1:20:18 PM Default Gateway . . . . . . . . . : 192.168.10.1 DHCP Server . . . . . . . . . . . : 192.168.10.1 DHCPv6 IAID . . . . . . . . . . . : 100177090 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-F3-76-75-54-E1-AD-DE-DA-9A DNS Servers . . . . . . . . . . . : 192.168.10.1 NetBIOS over Tcpip. . . . . . . . : Enabled
If a host is configured as a DHCP client, the IP address configuration can be renewed using the ipconfig /release and ipconfig /renew commands, as shown in the sample output.
C:\Users\PC-A> ipconfig /release (Output omitted) Wireless LAN adapter Wi-Fi: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::a4aa:2dd1:ae2d:a75e%16 Default Gateway . . . . . . . . . : (Output omitted) C:\Users\PC-A> ipconfig /renew (Output omitted) Wireless LAN adapter Wi-Fi: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::a4aa:2dd1:ae2d:a75e%16 IPv4 Address. . . . . . . . . . . : 192.168.1.124 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 (Output omitted) C:\Users\PC-A>
The DNS Client service on Windows PCs also optimizes the performance of DNS name resolution by storing previously resolved names in memory. The ipconfig /displaydns command displays all of the cached DNS entries on a Windows computer system, as shown in the example output.
C:\Users\PC-A> ipconfig /displaydns Windows IP Configuration (Output omitted) netacad.com ---------------------------------------- Record Name . . . . . : netacad.com Record Type . . . . . : 1 Time To Live . . . . : 602 Data Length . . . . . : 4 Section . . . . . . . : Answer A (Host) Record . . . : 54.165.95.219 (Output omitted)
IP Configuration on a Linux Host
Verifying IP settings using the GUI on a Linux machine will differ depending on the Linux distribution (distro) and desktop interface. The figure shows the Connection Information dialog box on the Ubuntu distro running the Gnome desktop.
On the command line, network administrators use the ifconfig command to display the status of the currently active interfaces and their IP configuration, as shown in the output.
[analyst@secOps ~]$ ifconfig enp0s3 Link encap:Ethernet HWaddr 08:00:27:b5:d6:cb inet addr: 10.0.2.15 Bcast:10.0.2.255 Mask: 255.255.255.0 inet6 addr: fe80::57c6:ed95:b3c9:2951/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1332239 errors:0 dropped:0 overruns:0 frame:0 TX packets:105910 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1855455014 (1.8 GB) TX bytes:13140139 (13.1 MB) lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The Linux ip address command is used to display addresses and their properties. It can also be used to add or delete IP addresses.
IP Configuration on a macOS Host
In the GUI of a Mac host, open Network Preferences > Advanced to get the IP addressing information, as shown in the figure.
However, the ifconfig command can also be used to verify the interface IP configuration a shown in the output.
MacBook-Air:~ Admin$ ifconfig en0 en0: flags=8863 mtu 1500 ether c4:b3:01:a0:64:98 inet6 fe80::c0f:1bf4:60b1:3adb%en0 prefixlen 64 secured scopeid 0x5 inet 10.10.10.113 netmask 0xffffff00 broadcast 10.10.10.255 nd6 options=201 media: autoselect status: active MacBook-Air:~ Admin$
Other useful macOS commands to verify the host IP settings include networksetup -listallnetworkservices and the networksetup -getinfo <network service>, as shown in the following output.
MacBook-Air:~ Admin$ networksetup -listallnetworkservices An asterisk (*) denotes that a network service is disabled. iPhone USB Wi-Fi Bluetooth PAN Thunderbolt Bridge MacBook-Air:~ Admin$ MacBook-Air:~ Admin$ networksetup -getinfo Wi-Fi DHCP Configuration IP address: 10.10.10.113 Subnet mask: 255.255.255.0 Router: 10.10.10.1 Client ID: IPv6: Automatic IPv6 IP address: none IPv6 Router: none Wi-Fi ID: c4:b3:01:a0:64:98 MacBook-Air:~ Admin$
The arp Command
The arp command is executed from the Windows, Linux, or Mac command prompt. The command lists all devices currently in the ARP cache of the host, which includes the IPv4 address, physical address, and the type of addressing (static/dynamic), for each device.
For instance, refer to the topology in the figure.
The output of the arp -a command on the Windows PC-A host is displayed.
C:\Users\PC-A> arp -a Interface: 192.168.93.175 --- 0xc Internet Address Physical Address Type 10.0.0.2 d0-67-e5-b6-56-4b dynamic 10.0.0.3 78-48-59-e3-b4-01 dynamic 10.0.0.4 00-21-b6-00-16-97 dynamic 10.0.0.254 00-15-99-cd-38-d9 dynamic
The arp -a command displays the known IP address and MAC address binding. Notice how IP address 10.0.0.5 is not included in the list. This is because the ARP cache only displays information from devices that have been recently accessed.
To ensure that the ARP cache is populated, ping a device so that it will have an entry in the ARP table. For instance, if PC-A pinged 10.0.0.5, then the ARP cache would contain an entry for that IP address.
The cache can be cleared by using the netsh interface ip delete arpcache command in the event the network administrator wants to repopulate the cache with updated information.
Common show Commands Revisited
In the same way that commands and utilities are used to verify a host configuration, commands can be used to verify the interfaces of intermediary devices. The Cisco IOS provides commands to verify the operation of router and switch interfaces.
The Cisco IOS CLI show commands display relevant information about the configuration and operation of the device. Network technicians use show commands extensively for viewing configuration files, checking the status of device interfaces and processes, and verifying the device operational status. The status of nearly every process or function of the router can be displayed using a show command.
Commonly used show commands and when to use them are listed in the table.
R3# show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone, D - Remote, C - CVTA, M - Two-port Mac Relay Device ID Local Intrfce Holdtme Capability Platform Port ID S3 Gig 0/0/1 122 S I WS-C2960+ Fas 0/5 Total cdp entries displayed : 1 R3#
The output displays that the R3 GigabitEthernet 0/0/1 interface is connected to the FastEthernet 0/5 interface of S3, which is a Cisco Catalyst 2960+ switch. Notice that R3 has not gathered information about S4. This is because CDP can only discover directly connected Cisco devices. S4 is not directly connected to R3 and therefore is not listed in the output.
The show cdp neighbors detail command reveals the IP address of a neighboring device, as shown in the output. CDP will reveal the IP address of the neighbor regardless of whether or not you can ping that neighbor. This command is very helpful when two Cisco routers cannot route across their shared data link. The show cdp neighbors detail command will help determine if one of the CDP neighbors has an IP configuration error.
As helpful as CDP is, it can also be a security risk because it can provide useful network infrastructure information to threat actors. For example, by default many IOS versions send CDP advertisements out all enabled ports. However, best practices suggest that CDP should be enabled only on interfaces that are connecting to other infrastructure Cisco devices. CDP advertisements should be disabled on user-facing ports.
Because some IOS versions send out CDP advertisements by default, it is important to know how to disable CDP. To disable CDP globally, use the global configuration command no cdp run. To disable CDP on an interface, use the interface command no cdp enable.
The show ip interface brief Command
One of the most frequently used commands is the show ip interface brief command. This command provides a more abbreviated output than the show ip interface command. It provides a summary of the key information for all the network interfaces on a router.
For example, the show ip interface brief output displays all interfaces on the router, the IP address assigned to each interface, if any, and the operational status of the interface.
R1# show ip interface brief Interface IP-Address OK? Method Status Protocol GigabitEthernet0/0/0 209.165.200.225 YES manual up up GigabitEthernet0/0/1 192.168.10.1 YES manual up up Serial0/1/0 unassigned NO unset down down Serial0/1/1 unassigned NO unset down down GigabitEthernet0 unassigned YES unset administratively down down R1#
Verify Switch Interfaces
The show ip interface brief command can also be used to verify the status of the switch interfaces, as shown in the output.
S1# show ip interface brief Interface IP-Address OK? Method Status Protocol Vlanl 192.168.254.250 YES manual up up FastEthernet0/l unassigned YES unset down down FastEthernet0/2 unassigned YES unset up up FastEthernet0/3 unassigned YES unset up up
The VLAN1 interface is assigned an IPv4 address of 192.168.254.250, has been enabled, and is operational.
The output also shows that the FastEthernet0/1 interface is down. This indicates that either no device is connected to the interface or the device that is connected has a network interface that is not operational.
In contrast, the output shows that the FastEthernet0/2 and FastEthernet0/3 interfaces are operational. This is indicated by both the status and protocol being shown as up.
Video – The show version Command
The show version
command can be used to verify and troubleshoot some of the basic hardware and software components used during the boot process. Click Play to view a video from earlier in the course, which reviews an explanation of the show version command.
Packet Tracer – Interpret show Command Output
This activity is designed to reinforce the use of router show commands. You are not required to configure, but rather examine, the output of several show commands.
Ready to go! Keep visiting our networking course blog, give Like to our fanpage; and you will find more tools and concepts that will make you a networking professional.