Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
University of Melbourne (Semester-2 2011) Department of Computer Science and Software Engineering
Engineering for Internet Applications Lab 1 Tooba Aamir - 396447 1. Write in your lab report a paragraph describing the drawbacks of using
network address translation, as opposed to using a unique IP address for every host.
Network Address Translation(NAT) translates private IP addresses and ports to public routable IP addresses. Foremost disadvantage in NAT is in usage of protocols in which the IP address is embedded within the packets, or with those where there is a need for a remote host to initiate a connection to the host behind the NAT because rewriting of packet headers has the potential to cause problems. In such cases IP forwarding is to be enabled before using NAT to make an Internet connection. [1] Also NAT provides minimum logging services. So because of the short-lived nature of the stateful translation tables in NAT routers, devices on the internal network lose IP connectivity typically within a very short period of time unless they implement NAT keep-alive mechanisms by frequently accessing outside hosts. This shortens the power reserves on battery-operated hand-held devices and decrease popularity of such Internet-enabled devices. Similarly, NAT is not adept in detecting attacks. [2]
2. Include the output of your program for the "www.unimelb.edu.au", "yahoo.com","google.com".
import java.net.*; import java.io.*; public class Main { public static void main(String[] args) { try{
following
inputs:
InetAddress localA = InetAddress.getLocalHost(); InetAddress add = InetAddress.getByName(args[0]); String Hostname = add.getCanonicalHostName(); String HostIP = add.getHostAddress(); System.out.println("Host Name is: "+ args[0]); System.out.println("Complete Host Name is: "+ Hostname); System.out.println("IP ADDRESS is: "+ HostIP);
www.unimelb.edu.au
www.yahoo.com
www.google.com
3. Include your entire source code in your report. Show the output for each of the same inputs from (2).
import java.net.*; import java.io.*; public class Main { public static void main(String[] args) { int timeout = 5000; try{ InetAddress localA = InetAddress.getLocalHost(); InetAddress add = InetAddress.getByName(args[0]); System.out.println("Host Name is: "+ args[0]); try { if(add.isReachable(timeout)) { System.out.println("IP ADDRESS is reachable!"); } else { System.out.println("IP ADDRESS is not reachable!"); } } catch (IOException e) {e.printStackTrace();} } catch( UnknownHostException e){} } }
www.unimelb.edu.au
www.yahoo.com
www.google.com