Networking Commands Lab Report
hostname
The hostname command is used to display the name of the machine.
Available Options:
- No option: Displays the machine's host name.
- -d: Displays the domain name that the machine is a part of.
- -f: Shows the fully qualified host and domain name.
- -i: Displays the IP address for the current machine.
Snapshot of Results:
Bash
bhagwan@ubuntu:~$ hostname
ubuntu
bhagwan@ubuntu:~$ hostname -d
ubuntu-domain
bhagwan@ubuntu:~$ hostname -f
ubuntu.ubuntu-domain
bhagwan@ubuntu:~$ hostname -i
127.0.1.1
ping
The ping command sends packets of information to a specified destination to verify that a network
connection can be established and to get timing information about the connection's speed. If you
ping a web address like www.yahoo.com, it will also display its IP address. The test can be stopped
by using ctrl+C.
Snapshot of Results:
Bash
bhagwan@ubuntu:~$ ping www.yahoo.com
PING www.yahoo.com (106.10.138.240) 56(84) bytes of data.
64 bytes from www.yahoo.com (106.10.138.240): icmp_seq=1 ttl=49 time=65.1 ms
64 bytes from www.yahoo.com (106.10.138.240): icmp_seq=2 ttl=49 time=64.8 ms
64 bytes from www.yahoo.com (106.10.138.240): icmp_seq=3 ttl=49 time=66.6 ms
64 bytes from www.yahoo.com (106.10.138.240): icmp_seq=4 ttl=49 time=66.8 ms
64 bytes from www.yahoo.com (106.10.138.240): icmp_seq=5 ttl=49 time=67.1 ms
64 bytes from www.yahoo.com (106.10.138.240): icmp_seq=6 ttl=49 time=67.0 ms
^C
--- www.yahoo.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5006ms
rtt min/avg/max/mdev = 64.899/66.293/67.135/0.908 ms
ifconfig
The ifconfig command is used to view the current configuration of network adapters. It is useful for
determining if there are any transmit (TX) or receive (RX) errors.
Snapshot of Results:
The example displays configurations for three interfaces: eth0 (Ethernet), lo (Loopback), and wlan0
(Wireless LAN).
Bash
bhagwan@ubuntu:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:22:19:ec:dd:89
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:17
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:4661 errors:0 dropped:0 overruns:0 frame:0
TX packets:4661 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:551355 (551.3 KB) TX bytes:551355 (551.3 KB)
wlan0 Link encap:Ethernet HWaddr 00:24:d6:2f:ab:6e
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::224:d6ff:fe2f:ab6e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:120161 errors:0 dropped:0 overruns:0 frame:0
TX packets:71702 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:155814164 (155.8 MB) TX bytes:9307327 (9.3 MB)
netstat
The netstat command is a versatile tool for finding connections to and from the host.
Available Options:
- -g: Displays all multicast groups the host has subscribed to.
- -nap | grep port: Shows the process ID of the application using a specific port.
- -a or --all: Displays all connections, including TCP and UDP.
- --tcp or -t: Displays only TCP connections.
- --udp or -u: Displays only UDP connections.
Snapshot of Results:
netstat -g
Bash
bhagwan@ubuntu:~$ netstat -g
IPv6/IPv4 Group Memberships
Interface RefCnt Group
lo 1 all-systems.mcast.net
eth0 1 all-systems.mcast.net
wlan0 1 224.0.0.251
wlan0 1 all-systems.mcast.net
lo 1 ip6-allnodes
lo 1 ff01::1
eth0 1 ip6-allnodes
eth0 1 ff01::1
netstat -t
Bash
bhagwan@ubuntu:~$ netstat -t
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 1 0 ubuntu:58502 backoo.canonical.c:http CLOSE_WAIT
tcp 28 0 ubuntu:54385 productsearch.ubu:https CLOSE_WAIT
nslookup
The nslookup command is used to find all the IP addresses for a given domain name. It can also be
used to convert a hostname to an IP address and an IP address back to a hostname.
Snapshot of Results:
Bash
bhagwan@ubuntu:~$ nslookup google.com
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
Name: google.com
Address: 173.194.36.0
Name: google.com
Address: 173.194.36.4
Name: google.com
Address: 173.194.36.8
Name: google.com
Address: 173.194.36.9
Name: google.com
Address: 173.194.36.14
Name: google.com
Address: 173.194.36.5
Name: google.com
Address: 173.194.36.3
Name: google.com
Address: 173.194.36.7
Name: google.com
Address: 173.194.36.6
Name: google.com
Address: 173.194.36.2
Name: google.com
Address: 173.194.36.1
traceroute
The traceroute utility shows the number of hops (intermediate systems) and the response time it
takes to reach a remote system or website.
Snapshot of Results:
Bash
bhagwan@ubuntu:~$ traceroute google.com
traceroute to google.com (173.194.36.0), 30 hops max, 60 byte packets
1 129.65.106.27.mysipl.com (27.106.65.129) 15.924 ms 15.901 ms 15.878 ms
2 129.65.106.27.mysipl.com (27.106.65.129) 15.860 ms 15.841 ms 15.825 ms
3 10.10.11.49 (10.10.11.49) 139.366 ms 139.374 ms 139.356 ms
4 72.14.242.50 (72.14.242.50) 15.733 ms 15.715 ms 15.699 ms
5 209.85.241.52 (209.85.241.52) 15.683 ms 15.655 ms 18.547 ms
6 209.85.241.187 (209.85.241.187) 18.541 ms 101.044 ms 100.996 ms
7 bom04s01-in-f0.1e100.net (173.194.36.0) 12.911 ms 12.883 ms 12.863 ms
finger
The finger command is an older Unix command used to view user information, such as their login
name, real name, terminal name, and write status.
Snapshot of Results:
Bash
bhagwan@ubuntu:~$ finger
Login Name Tty Idle Login Time Office Office Phone
bhagwan Bhagwan tty7 4:51 Jul 9 14:49 (:0)
bhagwan Bhagwan pts/0 Jul 9 14:50 (:0.0)
telnet
The telnet command connects to a destination host using the telnet protocol. It is typically used to
confirm that a host is active and that the network connectivity between two hosts is working
correctly. You can specify a port to connect to by using the format:
telnet hostname port
Snapshot of Results:
(Not provided in original document)