Professional Documents
Culture Documents
Winter 2018-19
Assessment 1
Slot: L19+20
Venue: SJT-216
1. Study and test the functionality of basic networking commands in the laboratory.
A.) PING
Ans: 10.10.2.198
ii) Check whether TCP/IP is properly installed and functioning in your system.
iii) Indicate what percentage of packets sent resulted in a successful response. For the packets
from which you received a response, write down the minimum, average and maximum round trip
times in milliseconds.
iv) Increase or Decrease the Time Interval between Packets. Write the response.
vii) Change Ping Packet Size of 512, 1024 bytes of data. Write the response.
x) For some of the hosts, you may not have received any responses for the packets you have sent.
What are the reasons for not getting a response?
Ans:
1. It means that your ICMP packet (ping) was silently discarded with no response sent.
2. probably disabled ping response for security reasons.
B.) IFCONFIG/IPCONFIG
i) What is the MAC address of the network interface card of your system?
Ans: b4:b5:2f:da:4f:a6
Ans: 10.30.140.45
iii) Find out all the network interfaces connected to your system.
Ans: ifconfig -a
eth0 Link encap:Ethernet HWaddr b4:b5:2f:da:4f:a6
inet addr:10.30.140.45 Bcast:10.30.140.255 Mask:255.255.255.0
inet6 addr: fe80::b6b5:2fff:feda:4fa6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:40540 errors:0 dropped:0 overruns:0 frame:0
TX packets:18122 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:50148654 (50.1 MB) TX bytes:2301529 (2.3 MB)
Interrupt:20 Memory:f7100000-f7120000
C.) HOSTNAME
Ans: DESKTOP-A6R68GV
Ans: A hostname is a label that is assigned to a device connected to a computer network and that is
used to identify the device in various forms of electronic communication, such as the World Wide
Web.
D.) NETSTAT
Ans: netstat -a
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:135 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:445 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:3306 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:3648 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:5040 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:5700 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:7779 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:9012 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:49664 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:49665 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:49666 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:49667 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:49668 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:49669 DESKTOP-A6R68GV:0 LISTENING
TCP 0.0.0.0:51910 DESKTOP-A6R68GV:0 LISTENING
TCP 127.0.0.1:5240 DESKTOP-A6R68GV:0 LISTENING
TCP 127.0.0.1:8884 DESKTOP-A6R68GV:0 LISTENING
TCP 127.0.0.1:9222 DESKTOP-A6R68GV:0 LISTENING
Ans: netstat -l
TCP [::]:135 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:445 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:3306 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:3648 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:5700 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:7779 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:49664 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:49665 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:49666 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:49667 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:49668 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:49669 DESKTOP-A6R68GV:0 LISTENING
TCP [::]:51910 DESKTOP-A6R68GV:0 LISTENING
TCP [::1]:49853 DESKTOP-A6R68GV:0 LISTENING
UDP [::]:5353 *:*
UDP [::]:5353 *:*
UDP [::]:5355 *:*
UDP [::]:51910 *:*
UDP [::1]:1900 *:*
UDP [::1]:58634 *:*
v) Find the statistics of all protocols.
Ans: netstat -s
IPv4 Statistics
IPv6 Statistics
ICMPv4 Statistics
Received Sent
Messages 506 2625
Errors 0 0
Destination Unreachable 202 1962
Time Exceeded 254 0
Parameter Problems 0 0
Source Quenches 0 0
Redirects 0 0
Echo Replies 44 4
Echos 6 659
Timestamps 0 0
Timestamp Replies 0 0
Address Masks 0 0
Address Mask Replies 0 0
Router Solicitations 0 0
Router Advertisements 0 0
ICMPv6 Statistics
Received Sent
Messages 51 150
Errors 0 0
Destination Unreachable 0 0
Packet Too Big 0 0
Time Exceeded 0 0
Parameter Problems 0 0
Echos 0 0
Echo Replies 0 0
MLD Queries 0 0
MLD Reports 0 0
MLD Dones 0 0
Router Solicitations 0 90
Router Advertisements 0 0
Neighbor Solicitations 0 30
Neighbor Advertisements 51 30
Redirects 0 0
Router Renumberings 0 0
Active Opens =2
Passive Opens =0
Failed Connection Attempts =4
Reset Connections =0
Current Connections =0
Segments Received = 12
Segments Sent =8
Segments Retransmitted =4
Ans: netstat -r
=======================================================================
====
Interface List
10...98 40 bb 14 b8 9a ......Realtek PCIe FE Family Controller
12...e6 02 9b f4 13 1b ......Microsoft Wi-Fi Direct Virtual Adapter
22...e4 02 9b f4 13 1c ......Microsoft Wi-Fi Direct Virtual Adapter #3
13...00 ff 5c 1b 46 77 ......TAP-Windows Adapter V9
3...e4 02 9b f4 13 1b ......Intel(R) Dual Band Wireless-AC 3160
1...........................Software Loopback Interface 1
=======================================================================
====
viii) By simply opening a browser connection to HTTP (port 80) server (while still offline!) what
will be status of netstat command?
Ans: The tracert command displays a list of all the routers that a packet must go through to get from
the computer where tracert is run to any other computer on the internet.
F.) NSLOOKUP
Non-authoritative answer:
Name: google.com
Addresses: 2404:6800:4002:808::200e
216.58.196.206
G.) ARP
1. How do you show the full ARP table for your machine? Capture a printout of what it is. Explain
each column of what is printed.
3. Write a java program to display the name of the computer and its IP address that you are
currently working on.
Ans:
for ip-address
import java.net.*;
public class MyAddress {
public static void main (String[] args) {
try {
InetAddress address = InetAddress.getLocalHost( );
System.out.println(address);
}
catch (UnknownHostException e) {
System.out.println("Could not find this computer's address.");
}
}
}
For name
import java.net.*;
public class ReverseTest {
public static void main (String[] args) {
try {
InetAddress ia = InetAddress.getByName("10.30.140.45");
System.out.println(ia.getHostName( ));
}
catch (Exception e) {
System.err.println(e);
}
}
4. Write a java program to print the IP address of www.google.com and all IP addresses of
www.microsoft.com .
Ans:
For google
import java.net.*;
public class AllAddressesOfgoogle {
public static void main (String[] args) {
try {
InetAddress[] addresses = InetAddress.getByName("www.google.com");
for (int i = 0; i < addresses.length; i++) {
System.out.println(addresses[i]);
}
}
catch (UnknownHostException e) {
System.out.println("Could not find www.microsoft.com");
}
}
}
For Microsoft
import java.net.*;
public class AllAddressesOfgoogle {
public static void main (String[] args) {
try {
InetAddress[] addresses = InetAddress.getAllByName("www.google.com");
for (int i = 0; i < addresses.length; i++) {
System.out.println(addresses[i]);
}
}
catch (UnknownHostException e) {
System.out.println("Could not find www.microsoft.com");
}
}
}
5. Write a java program to print all Network Interfaces of “localhost”.
Ans:
import java.io.*;
import java.net.*;
import java.util.*;
import static java.lang.System.out;
public class ListNets
{
public static void main(String args[]) throws SocketException
{
Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface netint : Collections.list(nets))
displayInterfaceInformation(netint);
}
static void displayInterfaceInformation(NetworkInterface netint) throws SocketException
{
out.printf("Display name: %s\n", netint.getDisplayName());
out.printf("Name: %s\n", netint.getName());
Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
for (InetAddress inetAddress : Collections.list(inetAddresses)) {
out.printf("InetAddress: %s\n", inetAddress);
}
out.printf("\n");
}
}
6. Write a java program to download the contents associated with a HTTP URL and save it in a
file.
Ans:
import java.io.*;
import java.net.*;
public class JavaGetUrl {
public static void main (String[] args) {
URL u;
InputStream is = null;
DataInputStream dis;
String s;
try {
u = new URL("http://200.210.220.1:8080/index.html");
is = u.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
while ((s = dis.readLine()) != null)
{
System.out.println(s);
}
}
catch (MalformedURLException mue)
{
System.out.println("Ouch - a MalformedURLException happened.");
mue.printStackTrace();
System.exit(1);
}
catch (IOException ioe)
{
System.out.println("Oops- an IOException happened.");
ioe.printStackTrace();
System.exit(1);
}
finally{
try
{
is.close();
}
catch (IOException ioe) {}
}
}
}