Routing
Table driven
Uses IP destination address to find next-hop
Next hop can be
-Router
-Final destination
Both hosts and routers have routing tables.
Example
Routing Table H3
| IP address: | Send to: |
| 30.0.0.0 | Deliver directly |
| <default> | R1 (30.0.0.1) |
Routing Table R1
| IP address: | Send to: |
| 30.0.0 | Deliver directly |
| 40.0.0.0 | Deliver directly |
| 129.3.0.0 | R3 (40.0.0.2) |
| <default> | R2 (40.0.0.2) |
Routing Table R2
| IP address: | Send to: |
| 30.0.0.0 | R1 (40.0.0.3) |
| 40.0.0.0 | Deliver directly |
| 129.3.0.0 | R3 (40.0.0.1) |
| 128.3.0.0 | Deliver directly |
| <default> | R4 (128.1.0.1) |
Example:
H3 sends packet to H1.
Dest:
H1->128.1.0.3
Src:
H3->30.0.0.3
H3 looks up routing table, sends packet to R1 (default->30.0.0.1).
R1 receives IP packet, looks up final destination in routing table,
sends
packet to R2 (40.0.0.2). R2 receives packet, delivers directly
because
it is on same network.
The ratio of destination networks that may appear in the routing table
is proportional
to the number of networks in the internet.
In LANS most of the networks are represented by a "default" entry in routing table.
In core routers in the backbone of the internet, the computers may have "all" the networks in the routing table.
Some sites that have a class A or class B address...
| 1 | 0 | Net | Subnet (8 bits) | Host (8 bits) |
...divide the host suffix into subnets and hosts.
A typical assignment of a class B is to divide the 64K hosts in 256
subnets
of 256 hosts each.
For example:
Subnet mask: Bit mask where a 1 indicates a net/subnet bit, and a 0
indicates
a host bit for 256 subnets 0-256 hosts each
Subnet mask: 255.255.255.0
net/subnet host
CS network:
128.10.6.0 -> class B
cholera.cs.purdue.edu -> 128.10.26.105
monkey.cs.purdue.edu -> 128.10.26.116
subnet -> 128.10.26.0
11-8-2000
New Project Assigned
Go to PSO to find out more...
Some sites may decide to break the host # port in subnets.
Class B address:
|<----------------Net #-------------->|<----------------Host #--------------->|
| Subnet # | Host # |
| # bits Subnet | # bits Host | Subnet Mask |
| 8 bits (256 Subnets) | 8 bits (256 Hosts) | 255.255.255.0 |
| 12 bits (4K Subnets) | 4 bits (16 Hosts) | 255.255.255.240 |
A Network that has been devided into subnets si still viewed as a single
network
from the point of view of the internet.
Subnetting is a local decision. The routers do not know about
it.
Only the local routers will know about subnetting.
When subnets are used, the routers need to know the subnet mask
to be able to extract the subnet number.
The internet routers use the network number to route a packet to the
final Network.
The local routers use the subnet mask to find out the sunbet number
and to know
which router to sent packet to.
Routing Tables:
Router 1:
| Network | Subnet Mask | Next Hop |
| 128.10.3.0 | 255.255.255.0 | Deliver Directly |
| 128.10.4.0 | 255.255.255.0 | Deliver Directly |
| Default | (Router 2) 128.10.4.6 |
Router 2:
| Network | Subnet Mask | Next Hop |
| 128.10.3.0 | 255.255.255.0 | (Router 1) 128.10.4.1 |
| 128.10.4.0 | 255.255.255.0 | Deliver Directly |
| Default | Router 3 |
Routing Algorithm Using Subnets
Take destination IP address (IPdest) and obtain the subnet number.
Subnet # = IPdest (bitwise AND) SubnetMask
Look up subnet number in routing table, and obtain the next hop.
Send packet to next hop or deliver directly.
Hosts also have routing tables.
IP destination address in IP packet is always the same
when it travels along the internet.
Hardware address in the Network Hardware (frame) is going
to change from hop to hop.
Local routers should know about the subnet mask.
If Host 1 sends a packet to Host 2, the IP destination is always
Host 2's IP address. But ethernet destination address will be
Router 1's
ethernet address in 128.10.3.0, and Host 1's ethernet address in 128.10.4.0.
11-10-2000
Remote Procedure Calls
Network abstraction to simplify programming of distributed applications.
The interaction between client and server is viewed as a procedure call.
Local Procedure Call
Same host, same process.
Remote Procedure Call
host 1
host 2
or
or
host 1, process 1
host 1, process 2
Internally:
Rfoo is also defined in the client as a "stub" procedure, that sends
the
arguments to the server and waits for the results.
Client:
// stub for rfoo
rfoo()
{
sends process #, args
waits for result
}
The server has a dispatcher that waits for a request, reads the process
#
and args, calls the corresponding procedures, and sends the results
back to client.
Server:
// real rfoo
dispatcher()
rfoo()
{
{
while(1)
...
{
}
receive process #
switch (process #)
{
case rfoo:
receive args
res = rfoo()
send res
break
...
}
}
}
There are tools such as "rpcgen" for sunrpc's that, given a rpc description
in
a rpc language, generate stubs for the client and the dispatcher
for the server.
Programmer uses the stubs and calls the procedures as if they were local.
Programmer only needs to write the remote procedure.
If client and server are in different machines with different architectures,
it will be necessary to convert the arguments and results to the local
representation.
Sunrpc translates arguments and results to an "external data representation"
(XDR)
before sending them through the network. When arguments and results
arrive,
it translates from XDR back to local representation.
Client
Network
Server
By using XDR:
Instead of having n(n-1) filters for conversion, only need n.
Translation from local to XDR is called "marshalling".
Translation from XDR to localling is called "unmarshalling".
Advantages of RPC's vs. Sockets
Easy to program distributed applications.
Programmer does not have to worry about type representation in different
architectures.
RPC's may run on top of different transfer protocols without having
to change the program.
Transparency - RPC's can be used as if they were local.
Disadvantages of RPC's vs. Sockets
Slower - RPC header that is appended, etc. and extra layer of software.
Programmer loses control in the network use that previously had with
sockets.
Fine tuing is more difficult.
Some applications may be difficult to represent with RPC.