To connect two computers without using a Hub or Switch you only need to do two things:
1. Use a crossover cable for this connection; refer to the diagram below to see how the two ends of a crossover cable are terminated.
2. Assign IP addresses to the computers; make sure the two computers are assigned IPs in the same network or subnet.
For example if you choose to use 192.168.1.0/24 as your network address, then:
PC1 à IP Address: 192.168.1.1 Subnet Mask: 255.255.255.0
PC2 à IP Address: 192.168.1.2 Subnet Mask: 255.255.255.0
You can test the connectivity using the usual ping command:
Open the command terminal on your PC.
From PC1: ping 192.168.1.2
From PC2: ping 192.168.1.1
Your connection is successful in you get ping replies with 0% packet loss.