NAT-Server Implementation-4

Posted by Muazzam Mehmood | - MS CS/IT, Study Stuff | Monday 2 March 2009 11:00 am

Continued from NAT-Server-3

We sniff the packets coming from the internet by simply sniffing the packets and distinguishing them from the packets from the local network packets by Checking for the destination IP address; this is because while manipulating the packets from the local network we changed the source IP to our NAT Server’s IP. So therefore all the packets coming from the Internet side would be destined for the NAT Server.

Now the Packets are re-manipulated such that the IP of the destination and the port number is now changed by first searching which of the node originated this request and then this ip address and the port number is changed accordingly.

Sending packets back in the network

Now when all the basic NAT process is done we send the packet back in the network where it reaches the respective node.

IMPORTANT FUNCTIONS

Some of the main functions which contribute to the proper working and implementation of our NAT Server are as follows:

Get_start_list():

This function along with the callback () function is used for sniffing the packets and extracting the fields of headers of different layers. This is the main combination of function which contributes a major portion to the sniffing process.

Update record:

This function is used to maintain the database for the nodes for which we have sent the data on the internet.

Time_to_live:

This function is used in synchronization with the reply of the packets sent on the internet

Search_db:

This function searches the maintained database when a reply from the internet comes, for determining which node in the internal network originated this request.

Make_tcp:

This function is used for the manipulating the packet which is to be NAT.

Make_udp:

This is used for the manipulation of the UDP packet to send on the internet.

IMPORTANT TECHNIQUES

Some of the important techniques used while implementing the NAT server are that we have done the sniffing technique using the socket programming library. Different processes of time to live, sniffing and database update and synchronized using posix threads using the pthread.h library.

Choices And Assumptions

First of all: we have to take make a change in approach of using two network interface card for local and outside network, this is because we are modeling the NATing Technique and not implementing the firewall in our design. In short we are only implementing the SNAT.

Secondly: we this design is implemented with consideration that we have a small network of about two or three nodes because of the memory limitation of the machines in the lab and at our home of handling large traffics.

Thirdly: COMPLEXITY IN IMPLEMENTATION

nat-terminology

While implementing the NAT Server the first difficulty which we faced was of sniffing the packet and correctly extracting the fields of the headers of different layers this problem was solved by thoroughly studying the related topics by taking help from the google.com and by using function such as ntohs(), e.g. to read total length field of the IP header. Second complexity which was raised was of correct Checksum of the packet at different layers this obstacle was cleared by carefully calculating the parameters of the checksum function. Thirdly and mainly we are having some problems with the reply back of the packets sent on the internet and as the reply are so un-predictable that nothing can be said about it.

Conclusion

In the end we have tried our best to meet the design of the SNAT to provide internet access to the local network connect to the NAT Server but there are still some complexities which are hindering the server to completely function as a true NAT Server.

NAT-Server Implementation-3

Posted by Muazzam Mehmood | - MS CS/IT, Study Stuff | Monday 2 March 2009 10:55 am

Continue from NAT-Server-2

NAT Server operate on IP packet-level, most of them have built-in inter-network routing capability. The inter-network they are serving can be divided into several separate sub networks (either using different backbones or sharing the same backbone) which further simplify network administration and allow more computers to be connected to the network:

NAT works at Layer 3 of OSI

nat-server-osi

In Short a NAT Server provides the following facilities:

Automatic firewall protection for the internal network; only destination request originated from the internal network will be accessible from the Internet

Automatic client computer configuration control

Packet level filtering and routing

Phases of Implementation

The implementation of Nat Server consists of the following phases:

Building a Sniffer

Manipulating the sniffed packets

Maintaining a record of the synchronized nodes and their packets

Sending the manipulated packets on the internet

Sniffing the incoming packets from the internet

Sending those packets back in the local network

Building a Sniffer

First of all we make a sniffer which can sniff the packets which collide with our network interface card. For this purpose we have to make the respective function which is able to receive the packet and store them for further manipulation. By further manipulation we mean that validating the sniffed packets and extracting the information stored in all the respective headers encapsulated along with data.

After we have sniffed the packets correctly we have to extract the header information from the packets. First of all the Ethernet header is inspected.

Ethernet Header:

The Ethernet header consists most importantly the MAC addresses of both the source and the destination hosts. We extract this information from here.

IP Header:

Next comes the IP header this has the ip addresses of both source and destination, the protocol which defines the protocol was used on the upper layer. We extract all the information stored in this header.

TCP/UDP/ICMP header:

In the upper layer one of these three protocols are used which is defined in the protocol field of the IP header. We also extract the information from this header, which completes our sniffing part.

Manipulating the sniffed packets

After the sniffing is complete we know alter the packets received as required for the NAT process. This is done by changing the IP address of the source and the by assigning a new port number to the packet which is now to be sent on the internet, for this purpose we make another packet having all the same values as the original packet except the source IP and the port no which is assigned according to our maintained database for the outgoing packets.

Maintaining a record

Once our packet is ready to be sent to the internet we make a table like database of the nodes for which we have manipulated the packets for and distinguish their different requests from the new port numbers assigned to them by our manipulating function.

Sending Packets on the Internet

After all the process of sniffing and maintaining databases we know send the packets on the internet through the pcap.h library functions of sending the packet.

Sniffing the internet packets

NAT-Server Implementation-2

Posted by Muazzam Mehmood | - MS CS/IT, Study Stuff | Monday 2 March 2009 10:40 am

Continue from NAT-Server-1

Each client has a time-out associated with it. Whenever new traffic is received for a client, its time-out is reset. When the time-out expires, the client is removed from the table. This ensures that the table is kept to a reasonable size. Also most of NAT implementations also track TCP clients on a per-connection basis and remove them from the table as soon as the connection is closed. This is not possible for UDP traffic since it is not connection based.

As the port mapping table has complete connection information – source and destination address as well as the port numbers – it is possible to check any of this information before passing incoming packets back to the client. This checking helps to provide effective firewall protection against Internet-launched attacks on the private LAN.

nat-router

Each IP packet also contains checksums that are calculated by the originator. They are recalculated and compared by the recipient to see if the packet has been corrupted in transition process. The checksums depend on the contents of the packet. Since the NAT must modify the packet addresses and port numbers, it must also recalculate and replace the checksums.

IMPORTANCE of NAT

IP Address Consideration

An IP address is 4 bytes, the total number of available addresses is 2 to the power of 32 = 4,294,967,296. is the total theoretical number of addresses that can be allocated to the computers that can be directly connected to the Internet. While this number of available addresses seems large, however if we connect each computer with the internet by assigning a unique address every node then this number is in-sufficient. While the next generation IP protocol, IP version 6, allows for larger addresses, it will take years before the existing network infrastructure migrates to the new protocol.

Because of this major problem shortage of IP addresses, most Internet Service Providers only allocate one address to a single customer, and most of the time this address is assigned dynamically, so every time a client connects to the ISP a different address will be provided. With an NAT gateway running on this single computer, it is possible to share that single address between multiple local computers and connect them all at the same time. The outside world is unaware of this multiplexed environment and takes the network as a signal computer.

Security Considerations

Another issue is of the security of the network or any other personal computer. To tackle the security problem, a number of firewall products are available. They are placed between the user and the Internet and verify all traffic before allowing it to pass through. This means, for example, that no unauthorized user would be allowed to access the computer’s resources. The problem with firewall solutions is that they are expensive and difficult to set up and maintain, putting them out of reach for home and small business users. NAT automatically provides a firewall protection without any special set up. This is because it only allows connections that are requested from local network. This means, for example, that an internal client can connect to an outside FTP server, but an outside client will not be able to connect to an internal FTP server.

Administrative Considerations

NAT is helpful to a network administration in several ways:

It can divide a large network into several smaller ones. The smaller parts expose only one IP address to the outside, which means that computers can be added or removed, or their addresses changed, without impacting external networks. With inbound mapping, it is even possible to move services (such as Web servers) to a different computer without having to do any changes on external clients.

Some of the modern NAT Servers contain a dynamic host configuration protocol (DHCP) server. DHCP allows client computers to be configured automatically; when a computer is switched on, it searches for a DHCP server and obtains TCP/IP setup information. Changes to network configuration are done centrally at the server and affect all the clients; the administrator does not need to apply the change to every computer in the network. The new configuration will be assigned to the node next time it starts.

NAT-Server Implementation-1

Posted by Muazzam Mehmood | - MS CS/IT, Study Stuff | Monday 2 March 2009 10:23 am

This project report provides the implementation of NAT-Network Address Translate Server. It gives the detailed description of different phases of implementation of NAT Server. NAT Server allows us to share a common internet connection between multiple computers on a network. The project implementation under discussion is done in Microsoft Visual C++. The machine running the NAT Server has network connection through one network card (or modem) and allows computers connected to a network visible through the second server network card to share its internet connection. The project is completed and function with the TCP, UDP and ICMP internet protocols.

nat-server

The basic purpose of a NAT Server is to multiplex traffic from the network and present it to the outer world (Internet) as if it was coming from a single computer having only one IP address.

The TCP/IP protocols include a multiplexing facility so that any computer can maintain multiple simultaneous connections with a remote computer. It is this multiplexing facility that is the key to single address NAT.

To multiplex several connections to a single destination, client computers label all packets with unique “port numbers”. Each IP packet starts with a header containing the source and destination addresses and port numbers.

The TCP/IP connection is completely defined by a combination of these IP and port numbers. The addresses specify the two machines at both ends, and the two port numbers ensure that each connection between this pair of machines can be uniquely identified.

Each unique source port number in the client can originate a separate connection, and all reply packets to these requests contain the same number as their destination port, so that the client can maintain record as to which the application originated the respective request. In this way it is possible for a web browser on the client to ask a web server for several frames at once and to know how to put all the parts of all the responses back together.

A NAT Server must change the Source address on every outgoing packet to be its single public address. It therefore also renumbers the Source Ports to be unique, so that it can keep track of each client connection. The NAT Server uses a port mapping table to remember how it renumbered the ports for each client’s outgoing packets. The port mapping table relates the client’s real local IP address and source port plus its translated source port number to a destination address and port. By using this technique it can reverse the process for returning packets and route them back to the respective clients.

When any remote server responds to an NAT client, incoming packets arriving at the NAT gateway will all have the same Destination address, but the destination Port number will be the unique Source Port number that was assigned by the NAT. The NAT Server looks in its port mapping table to determine which of its own local client address and port number a packet is destined for, and replaces these numbers before passing the packet on to the client.

When a packet is received from an internal client, NAT looks for the matching source address and port in the port mapping table. If the entry is not found, a new one is created, and a new mapping port allocated to the client:

Incoming packet received from local client

Look for source address, port in the mapping table

If found, replace source port with previously allocated mapping port

If not found, allocate a new mapping port

Replace source address with NAT address, source port with mapping port

Packets received from the outside world undergo a reverse translation process:

Incoming packet received from Internet

Look up destination port number in port mapping table

If found, replace destination address and port with entries from the mapping table

If not found, the packet is not for us and should be rejected

Oracle Database in a Glance

Posted by Muazzam Mehmood | - MS CS/IT, Study Stuff | Friday 13 February 2009 9:26 am

Prominently, Oracle is the name of the database management system that is introduced by the Oracle Corporation.

Referring to Oracle products, Oracle9i is the latest product released by Oracle Corporation. In comparison to Oracle products and unlike Oracle8i, which is only a database management system, Oracle9i comprises of the following software:

Oracle9i Application Server – Oracle9iAS

Oracle9i Database Server – Oracle9iDB

Oracle9i Developer Suite – Oracle9iDS

More elaborately, Oracle9i is a platform and not a simple database management system.

By the way, Oracle9iDB is the database management system that is used to store and access data. Oracle is the most widely used relational database management system (RDBMS).

Be acknowledged, the Oracle Corporation is second largest software company next to Microsoft. Oracle Corporation has been targeting Internet programming with the caption – software powers the internet.

Furthermore, Oracle Corporation is also into Enterprise Resource Planning (ERP). It has Oracle Applications that includes Oracle Financials and many more.

The Oracle Database-Server

As we know that Oracle database server is one of the databases that are widely used in client/server computing as back-end. Front-end programs that are written using application development tools such as Visual basic access Oracle and submit SQL commands for execution.

Oracle8i onwards oracle is trying to provide extra facilities that are required to be an internet database.

oracle-1

We know that the Oracle8i provides special features to support various types of data that is to be stored in web sites. Oracle supports both OLTP (online transaction processing) applications as well data warehouse applications, which contain a very large database (VLDB).

One of the biggest advantages of Oracle has been its presence on around 100 different platforms. Oracle is quite scalable, which means it can scale up and down very easily as the requirements change.

Oracle also provides Java Virtual Machine (JVM) as part of database. This enables oracle to run java programs. In fact, starting from Oracle8i, oracle can run programs written either in PL/SQL or Java.

What is Oracle Instance?

The Oracle instance is a collection of memory structures and processed that is used to manage oracle database. Each oracle database is to be accessed by one or more Oracle instances. If two or more instances are accessing the same database, it is called as parallel server architecture.

Whenever we start using an oracle database, we must first start Oracle instance. Oracle instance will them open the database and make it available to users.

Furthermore in the nutshell, every oracle installation contains at least one Oracle Instance and one oracle database

oracle-2

Understanding a Personal-Oracle

When talking about the Personal Oracle, it is one of the flavors of Oracle. This is not a product that is used by production system (systems where real data is stored). Elaborately, this is more like a learning tool since it runs on desktop PCs. In personal oracle, oracle instance, oracle database and client application all run on the same machine (see figure 3). Unlike others, in the Oracle database server, only oracle instance and database reside on the server and client applications run on clients.

oracle-3

Moreover, it is also possible to develop an applications using Personal Oracle on your desktop/laptop and deploy them in a client/server environment.

Next Page »
VoucherMag Wordpress Theme