Sunteți pe pagina 1din 6

IP Networking Tutorial

Brief abstract of IP Networking

TkT Private and confidential

Alcatel-Lucent Proprietary and Confidential

IP Networking Tutorial
Introduction
Suppose a machine has two IP interfaces: one ethernet and one X.25. When you 'ping some_other_machine', how does IP know whether to select the ethernet line or the X.25 line? This chapter looks at the internals of how IP determines routes and how you can pick IP addresses to simplify this.

Definitions
In order to understand routing, it is important to understand the term "IP network". Generally, each physically separate connection is a separate IP network. Therefore, if you have Ethernet attached to your machine, that is one network. If you have an X.25 network connection, that is a different IP network. The other key part to note about the definition of an IP network is that each network (each physical connection) must have a different network portion in its address. For example: 192.44.44.something for interfaces on one ethernet network 192.33.33.something for interfaces on another ethernet network 192.25.25.something for interfaces on a wide area network

IP Network Classes
An internet adress is a 32-bit number used to uniquely identify each host attached to an internet. We write addresses as a sequence of four eight-bit decimal numbers, separated by periods ("dot format"). TCP/IP implementations consider addresses as a two-part value: a network portion and a host portion. There are three clases of internet networks defined for TCP/IP internets. The table below shows how the network portion of a dot format address of X.X.X.X takes up from one to three of the leading X's. Class Network Portion Host Portion Number of Hosts Sample IP Address A B C 0-127 128-191.X 192-255.X.X X.X.X X.X X 16,777,216 65,536 256 10.55.110.222 128.123.90.2 192.5.10.69

X is a value between 0 and 255.


Alcatel-Lucent Proprietary and Confidential

Note that the above rules can be overridden by netmasks that extend the network portion of the address.

Broadcast Addresses
Normally, an internet address refers to a single host. The broadcast address refers to all hosts on a network, and is an address with the host portion bits of the address all 1. The following are some IP addresses and associated broadcast addresses. Class IP Address Broadcast Address A B C 10.55.110.222 10.255.255.255 128.123.90.2 128.123.255.255 192.5.10.69 192.5.10.255

When the network number of the broadcast address is also all 1's (255.255.255.255), the packet applies only to the local network. A broadcast address with a specific network number (such as those in the list above) refers to the network identified, which does not need to be directly connected to the local network.

Default Gateway
The destination address of outbound packets is used to determine which network interface to use. If the destination address does not fall within any of the available networks, the packet will be sent to the default gateway. It will be the responsibility of the default gateway to correctly route the packet to the destination address. The default gateway is specified during TCP/IP configuration of the IP Address and Subnet Mask of the network interface.

Local IP Networks
We refer to a local IP network as one whose network portion of each IP address matches one in the user's machine. For example, one machine might use: 192.44.44.3 for ethernet 192.25.25.1 for X.25 Networks 192.44.44.something and 192.25.25.something are therefore local IP networks from this machine's perspective. Now let's go back to our original problem -- with specific numbers. Suppose data is to be sent to 192.25.25.3. Which interface will IP use? It will use X.25, not ethernet. This is because the network portion of the address of the destination machine (192.25.25) matches the network portion of the local X.25 IP interface. It should now be clear why each interface must have a different network portion in its address. If one uses 192.25.25.something for both X.25 and ethernet and wanted to deliver data to 192.25.25.3, IP would not know whether to use ethernet or X.25.
Alcatel-Lucent Proprietary and Confidential

Foreign IP Networks
A host on a foreign IP network is a host with an IP address whose network portion does NOT match ANY of those in the user's machine. Let's go back to the example above. If there is data to deliver to host 192.33.33.2, should IP send it to the ethernet interface or the X.25 interface? Unless other steps are taken, IP will not know (and it will not guess) and you will likely see messages like "no route to host". So how do you set up routes to foreign hosts? The first answer is try to avoid the issue if you can. When you have complete control over the selection of IP addresses, the easiest (and therefore generally preferable) method of handling IP routing is to assign everyone on one physical connection with the same network portion. For example, all the hosts on ethernet (including the local interface) may be 192.44.44.something and all the hosts that can be reached via X.25 (including the local WAN Pseudo Adapter Interface) may have an IP address of 192.25.25.something. IP will then implicitly know how to reach the remote hosts (as described above). But what if the network portion of the address of someone you want to reach is not on the same network as any of the local interfaces? This question breaks down into two situations: access via another host direct network connections

Access Via Another Host


A very common scenario is that you have to reach a remote LAN via a gateway:

If a user on scrooge attempts to access louie (192.33.33.3), IP will not automatically know how to reach that host.

Alcatel-Lucent Proprietary and Confidential

By now, the experienced IP administrator will be thinking of the IP command route add .... There is however one very common pitfall that you must watch out for. The first thing you might want to do in the above example is:
route add 192.33.33.3 192.25.25.1

This tells IP to send any data addressed to 192.33.33.3 to 192.25.25.1. You do NOT want to do this. Never route data via your own machine's IP address. Think of this from IP's perspective. You are telling it to send the data to 192.25.25.1 first. IP looks at this and responds "OK, I'm already there. 192.25.25.1 is me." Therefore, the data does not get sent to any interface. The remote machine doesn't get the data. What you need to do is route the call to some remote host. The network portion of the IP address should match the appropriate local interface, but the host portion must be different. You can use:
route add 192.33.33.3 192.25.25.3

Direct Network Connections


The second situation that you may run into can be slightly more difficult. Note that dewey's X.25's IP address has been changed below to fit this situation.

Here we want to consider accessing dewey (192.66.66.3) from scrooge. Since the network portion of dewey's IP address does not match any of the interfaces in scrooge, IP will not automatically know how to reach it. Again, do not tell the IP software in scrooge to route via 192.25.25.1 or the data will not actually leave scrooge. There are two solutions to this problem: create an Additional Local IP Address for your own machine or create an Aliased Remote IP Address.
Alcatel-Lucent Proprietary and Confidential

An Additional Local IP Address The Pseudo Adapters used by WanWare NT are logical devices and not directly associated with physical connections. We can therefore have two pseudo adapters on scrooge even if there is only one data network connection. Each pseudo adapter will have it's own local IP address. Suppose we assign [2] WAN X.25 Pseudo Adapter and [4] WAN X.25 Pseudo Adapter with addresses 192.25.25.1 and 192.66.66.1 respectively. Using WANConfig, both interfaces can be used to communicate with remote hosts via the same X.25 wire. Now scrooge has an interface on network 192.66.66 and IP will automatically know which interface to use to get to dewey (192.66.66.3). Since there is a limit of 32 Pseudo Adapters, additional local IP address are most useful when the number of IP networks you need to communicate with is small. To add Pseudo Adapters, see Additional X.25 or Frame Relay IP Interfaces using the Help icon in the WanWare NT program group. An Aliased Remote IP Address As an alternative to the above solution, create an alias for dewey's X.25 IP interface: 192.25.25.100. First tell IP to route to this address:
route add 192.66.66.3 192.25.25.100

Now IP will try to send the data to 192.25.25.100, the alias for the remote host. Also, since the local IP address for the pseudo adapter is 192.25.25.1, IP will send the data to WanWare NT -exactly what you want. There is just one thing more that you need to do. WanWare NT will be told to send the data to 192.25.25.100 (the alias). If you set up the remote host for this IP address (using WANConfig), WanWare NT can deliver it. Just change the entry in WANConfig's Remote Hosts database for dewey to the alias address. That is, from IP Address: 192.66.66.3 to IP Address: 192.25.25.100 That's all. Note that what you have effectively done is created an alias name for routing purposes only; the destination address in the IP datagrams is the original, real IP address. For all other purposes but routing, you can refer to the remote by its real name or address. Creating aliases for remote hosts is best used when the number of different IP networks in your system is large.

Alcatel-Lucent Proprietary and Confidential

S-ar putea să vă placă și