IP ROUTING (Nov. 6, 2000)
Router
    -Specialized piece of hardware
    - A computer running routing software (routed,gated)
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 R1
Routing Table R2
30.0.0.0
delivers directly
30.0.0.0
R1(40.0.0.3)
40.0.0.0
delivers directly
40.0.0.0
delivers directly
124.3.0.0
R3(40.0.0.1)
124.3.0.0
R3(40.0.0.2)
128.1.0.0
R2(40.0.0.2)
128.1.0.0
delivers directly
default
R2(40.0.0.2)
default
R4(128.1.0.1)

Example:
    H3 sends a packet to H1
    dest  H1 -> 128.1.0.3
    src    H3 ->  30.0.0.3
    H3 looks up routing table and sends packet to R3(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 that directly because it is in the same network.

Because each destination network may appear in the routing table,
the size of the routing table is proportional to the number of networks in the internet.
In LAN, most of the networks in internet are represented by a "default" entry in routing table.
In core routers in the backbone of the internet, the routers may have "all" networks in internet.

Some sites that have a class A or class B address divide the host suffix into subnets and hosts

A typical assignment of a class B is to divide the 64K host in 256 subnets of 256 host each

For example:
    Subnet mask
            bit mask where    1 - net/subnet
                                       0 - host
             For 256 subnets  0 of 256 host each
             Subnet mask
                    255.255.255.0

CS Network
    128.10.0.0 -> Class B
    10000000
    Subnet mask
    255.255.255.0
    monkey.cs.purdue.edu -> 128.10.26.116
    cholera.cs.purdue.edu ->  128.10.26.105
    subnet                         -> 128.10.26.0



 
Nov. 8, 2000
- Some sites may decide to break the host # port in subnets.
 
# 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 divided into subnets is 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
Router 2
Network
Subnet mask
Next hop
Network
Subnet mask
Next hop
128.10.3.0
255.255.255.0
Delivers directly
128.10.3.0
255.255.255.0
(Router 1)   128.10.4.1
128.10.4.0
255.255.255.0
Delivers directly
128.10.4.0
255.255.255.0
Delivers directly
Default
 
(Router 2) 128.10.4.6
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.



 
Remote Procedure Calls (RPC) (Nov. 10, 2000)
Network abstraction to simplify programming of distributed applications.
The interaction between client and server is viewed as a procedure call.

Internally:
    - rfoo() is also defined in the client as a "stub" procedure that sends the arguments to the server
      and waits for the results.

The server has a "dispatcher" that waits for a request, reads the procedure # and args, calls the
corresponding procedures, and sends results back to client.

-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.

-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.