With our basic knowledge of TCP/IP we now need to put an IP address/netmask pair onto our network interface card.
Presuming we have 2 workstations; on Workstation A we are going to put an IP address of 192.168.0.1 and on Workstation B an IP address of 192.168.0.2
The subnetmask is going to be a standard Class C subnetmask (255.255.255.0).
What that means is that both these workstations are on the same network (you can do the calculations yourself).
Now the question is - how do you configure your IP address?
Unlike other operating systems you can configure a lot of your Linux operating system on the fly (you will probably have come across that as you worked through these courses), but configuring on the fly has some advantages and some distinct disadvantages.
One of the advantages of being able to configure Linux on the fly is that you can change things without having to go through reboot process and that makes it quick and easy, cheap and dirty. The problem is that if you configure on the fly you can often end up with a system that works fine until its rebooted at which point things aren't the way you think you set them up.
We could, for instance run "ifconfig eth0 192.168.0.1 netmask 255.255.255.0" which would configure our Ethernet 0 interface.
Note | |
---|---|
If a netmask other than the default one for this class is used, the ifconfig command MUST specify the broadcast address too. For example if we choose a subnet mask of 255.255.252.0, then we should specify the ifconfig command as follows:[3] |
ifconfig eth0 192.168.0.1 netmask 255.255.252.0 broadcast 192.168.3.255 |
Run "info" on ifconfig to learn more about this command.
Basically the ifconfig command sets an IP address onto your Ethernet 0 interface.
Once that Ethernet 0 interface has an IP address run "ifconfig eth0" and you should see the following:
The hardware address and that is the MAC address as we discussed earlier in the course.
An IP address and that should be 192.168.0.1
As part of the command netmask, which as we stipulated above is standard Class C netmask
A broadcast address. We stated earlier that the broadcast address is where all the host bits are 0 or 1 and if we look at our broadcast address now we should get 192.168.0.255.
And finally we should see some stats on packets transmitted and received.
In your test network you are going to have to configure, one IP address per workstation, and in the example just done we have already configured Workstation A.
On Workstation B you are going to run a similar command, but instead of 192.168.0.1 it is going to be 192.168.0.2. Testing the set-up with ping
The first thing you're going to want to do now is see if these two machines respond to one another, and the best way of doing that, is to use the packet Internet groper or the ping command
Assuming that you are sitting at Workstation A you might want to ping 192.168.0.2, which is Workstation B.
You may need to understand a little bit about the ping command in order to understand what you are testing. When you ping something it sends a 64 byte packet (echo request) to the other machine that you are setting up, in our case, Workstation B. As soon as Workstation B receives the packet, it replies with an echo reply by sending a 64 byte packet back to workstation A.
When we do a ping we are sending a packet called an ICMP packet, and that stands for an Internet Control Message Protocol.
The ICMP originates from within the network layer.
Look at our two machines and the network layer and the MAC layer. The packet originates at the network layer it proceeds down the stack as we have seen, onto the physical network and then reaches its destination and moves up the protocol stack but it does not go all the way up to the application layer it only goes to the ICMP layer - which is a sub-layer within the network layer.
When the packet is received by Workstation B it is then sent back to Workstation A in the same manner through the stack.
To repeat the process: When you ping something you send a 64 byte packet, a 64 byte ICMP packet from the network layer to the MAC layer, to the physical layer which then goes to Workstation B. The packet then goes up from the physical layer to the MAC layer, from the MAC layer to the network layer and when the network layer receives this package, the packet, it replies.
Ping is a good way of testing whether you get connectivity between two workstations but unfortunately it is not necessarily an end to end service indicator. The reason for this is that an ICMP packet never reaches the application layer, so although you can ping two machines it doesn't mean to say that you can send email between those two machines.
At some higher layer (perhaps at the transport layer or the application layer) the protocol could actually break down and therefore there is no end-to-end connectivity from an application perspective.
So ping is useful and you can use it for a lot of different tests but not necessarily an end-to-end service test and in modern computer terms this is really what people are interested in.
OK, so, once you've got your machines connected and you can see them and you can ping between one workstation and another, you should see that you get a reply for every packet that is sent. We will investigate the ping command in a little more detail shortly, because it is certainly your first port of call when trying to fix problems on a network.
[3] Linux has a nifty program: ipcalc. It allows you to quickly display broadcast addresses, network addresses of other useful information.