Please read the assignment description before class.


Okay class, for this assignment, you're going to implement a layer-3 load
balancer.

Some background:
Web servers must serve up a lot of data. To handle the amount of processing
they must perform, web servers are frequently implemented by using clusters
of machines. A layer-3 load balancer sits in front of the web server
cluster. When requests come to the webserver, they rewrite the IP
destination address "redirect" the connection to one of the webservers in
the cluster.

The layer-3 load balancer you will write will use a simplified algorithm.
You are to retrofit the l3forwarder code you compiled in the first
assignment.

The makefile to compile the l3forwarder microcode can be found here:
/opt/ixasdk/src/microace/ucbuild/Makefile.win

We will set up new virtual in virtual interfaces on the source and sink
machines.
If you are group X, the new IP addresses will be:
Source: 10.X.0.100, 10.X.0.101
Sink:   10.10X.0.3, 10.10X.0.4

10.X.0.100  ----> 10.X.0.1    IXP    10.10X.0.1 ----> 10.10X.0.3
10.X.0.101             (VIP 10.10X.0.2)               10.10X.0.4


The algorithm you will use is as follows:


if the destination address is 10.X.0.2:
      if the least significant bit is not set in the source address
            set the destination address to 10.10X.0.3
      else
            set the destination address to 10.10X.0.4
if the source address is 10.10X.0.3 or the source address is 10.10X.0.4
      set the source address to 10.10X.0.2


To test your algorithms, we will set up 2 webservers on the sink machines,
one which responds to queries on coming from 10.10X.0.3 and one to respond
to queries on 10.10X.0.4.

Some hints:
(Seriously, this is not just fluff, you should read it carefully)

      You are allowed to hardcode IP addresses in your source. We don't mind.

      These are the two functions you probably need to modify:
            L3Fwdr.cpp, L3Fwdr::Forward
            IPv4UnicastFwd.uc, IPv4UnicastFwd()

      To better understand the HTTP protocol, you can consult RFC 1945 (http/1.0)
and/or RFC 2616 (http/1.1). For the sake of simplifying your assignment, all
you need to know is that you can issue an HTTP/0.9 request with the
commands:
      telnet www.google.com 80
      GET /

      Also, to specify the local interface that you wish to bind to when
telnetting somewhere, you can use the -b modifier. So you can test your
implementation with the commands:
      telnet -b 10.X.0.100 10.10X.0.2 80
      telnet -b 10.X.0.101 10.10X.0.2 80

      Where "X" is your group number.

      Note that when you rewrite the destination IP address in a packet, you must
re-checksum the IP header. This code should be taken care of when the l3
forwarder decrements the IP TTL field.

      tcpdump -vvv will validate checksums.
      For unknown reasons, tcpdump on marvel will not report invalid tcp
checksums for TCP packets with no data (ie. SYN, SYNACK, ACK)

      rebooting the ixp helps. Everytime I build my program, I reboot the ixp. I
kid you not. I must've rebooted the ixp a few hundred times.

      while programming my solution, I had to reboot the host machine a few
times. A great pain. Expect this.

      printf is your friend. The ixp is not.

      The strong-arm core is little-endian. Remember to use ntohl(), ntohs(),
htonl(), htons() when appropriate.

      TCP Specs: RFC 793
      Calculation of Internet Checksum: RFC 1071
      Fast calculation of Internet Checksum: RFC 1141

      You MUST recalculate the TCP checksum. I used the fast  recalculation
method. I thought this would be easier and more  efficient than fetching the
WHOLE packet from memory. I was probably wrong. The arcane math of using a
fast tcp checksum  recalculation will surely render a sane man mad.

      Advise you strongly to have microcode punt to the strongarm core (slow
path) for packets with "magic" src/dest ip addresses. If  you can
successfully do a microcode-only implementation, you  will earn the title of
"master hacker" and the respect of your  instructor. The TA burned a lot of
time trying to do a microcode  only implementation and failed. A pure
microcode solution is worth bonus points.

      We only require that ICMP/TCP packets get translated properly.

      ICMP echo replies will be recognized by marvel, even if their  source IP is
not properly set.

      New virtual interfaces can be set up with the command:
            ifconfig eth0:1 10.X.0.101 netmask 255.255.255.0
            ifconfig eth0:2 10.X.0.102 netmask 255.255.255.0
      Of course, you should replace "eth0" and the IP addresses with whatever
interface your group is using.

      The TA likes cookies.


--
Francis
francis@{cse.ogi.edu, francischang.com}
OGI School of Science & Engineering at OHSU, SySL Labs
(503) 332-4850          FAX:(503) 748-1553

Yahoo! Groups Sponsor

To unsubscribe from this group, send an email to:
ogi-cse58x-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.