Skip to content

Commit 15596f3

Browse files
committed
simple router
0 parents  commit 15596f3

25 files changed

+3813
-0
lines changed

.DS_Store

8 KB
Binary file not shown.

INSTRUCTIONS

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
This document describes the environment for the Mininet sr assignment. You will
2+
login to a virtual topology like this one:
3+
4+
5+
Application Server 1
6+
+====================+
7+
| |
8+
| 192.168.2.2 |
9+
| |
10+
+====================+
11+
/
12+
/
13+
/
14+
eth3: /
15+
10.0.1.1 / eth1: 192.168.2.1
16+
+============(eth1)==+
17+
| |
18+
Internet =============(eth3) Your Router |
19+
| |
20+
+============(eth2)==+
21+
\ eth2: 172.64.3.1
22+
\
23+
\
24+
\
25+
+====================+
26+
| |
27+
| 172.64.3.10 |
28+
| |
29+
+====================+
30+
Application Server 2
31+
32+
33+
To connect to a topology, first compile the stub code.
34+
Then, you can invoke sr as follows:
35+
36+
$ ./sr
37+
38+
By default, ./sr will connect to the mininet controller on localhost.
39+
If you would like to run "sr" remotely, invoke sr as follows:
40+
41+
$ ./sr -s <controller_ip>
42+
43+
Your output upon connecting should look like this:
44+
45+
Using VNS sr stub code revised 2009-10-14 (rev 0.20)
46+
Loading filters
47+
---------------------------------------------
48+
no filters specified. accepting all connections.
49+
---------------------------------------------
50+
Client ubuntu connecting to Server localhost:8888
51+
Requesting topology 0
52+
successfully authenticated as ubuntu
53+
Connected to new instantiation of topology 0
54+
Loading routing table
55+
---------------------------------------------
56+
Destination Gateway Mask Iface
57+
192.168.2.2 192.168.2.2 255.255.255.255 eth1
58+
172.64.3.10 172.64.3.10 255.255.255.255 eth2
59+
10.0.1.100 10.0.1.100 255.255.255.255 eth3
60+
---------------------------------------------
61+
Router interfaces:
62+
eth3 HWaddrc2:e3:78:bf:71:f9
63+
inet addr 10.0.1.1
64+
eth2 HWaddr26:e4:1f:26:49:ab
65+
inet addr 172.64.3.1
66+
eth1 HWaddr56:01:ec:fb:34:09
67+
inet addr 192.168.2.1
68+
<-- Ready to process packets -->
69+
70+
71+
IMPORTANT: The system has more users than IP addresses, so you are not assigned
72+
a particular set of static IP addresses. This means each time you connect you
73+
MAY receive a different set of IP addresses. However, the system remembers the
74+
last IP block assigned to you and will always re-assign it to you unless someone
75+
else is currently using it (in which case you will get a new set of IP
76+
addresses). Your routing table (stored in rtable.vrhost) will be automatically
77+
updated by the stub code.
78+
79+
Please verify that you can see packets arriving to your topology when you try
80+
and ping one of your router interfaces. To do this, connect to your topology as
81+
described above and try and ping eth0 (e.g., 171.67.238.32 in this example).
82+
83+
$ ping 171.64.3.10
84+
85+
You should see output from sr that looks like:
86+
87+
*** -> Received packet of length 42
88+
*** -> Received packet of length 42
89+
*** -> Received packet of length 42
90+
91+
If so, everything is working! If not, please post your question on piazza.
92+
93+
Good Luck!

Makefile

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#------------------------------------------------------------------------------
2+
# File: Makefile
3+
#
4+
# Note: This Makefile requires GNU make.
5+
#
6+
# (c) 2001,2000 Stanford University
7+
#
8+
#------------------------------------------------------------------------------
9+
10+
all : sr
11+
12+
CC = gcc
13+
14+
OSTYPE = $(shell uname)
15+
16+
ifeq ($(OSTYPE),CYGWIN_NT-5.1)
17+
ARCH = -D_CYGWIN_
18+
endif
19+
20+
ifeq ($(OSTYPE),Linux)
21+
ARCH = -D_LINUX_
22+
SOCK = -lnsl -lresolv
23+
endif
24+
25+
ifeq ($(OSTYPE),SunOS)
26+
ARCH = -D_SOLARIS_
27+
SOCK = -lnsl -lsocket -lresolv
28+
endif
29+
30+
ifeq ($(OSTYPE),Darwin)
31+
ARCH = -D_DARWIN_
32+
SOCK = -lresolv
33+
endif
34+
35+
CFLAGS = -g -Wall -ansi -D_DEBUG_ -D_GNU_SOURCE $(ARCH)
36+
37+
LIBS= $(SOCK) -lm -lpthread
38+
PFLAGS= -follow-child-processes=yes -cache-dir=/tmp/${USER}
39+
PURIFY= purify ${PFLAGS}
40+
41+
# Add any header files you've added here
42+
sr_HDRS = sr_arpcache.h sr_utils.h sr_dumper.h sr_if.h sr_protocol.h sr_router.h sr_rt.h \
43+
vnscommand.h sha1.h
44+
45+
# Add any source files you've added here
46+
sr_SRCS = sr_router.c sr_main.c sr_if.c sr_rt.c sr_vns_comm.c sr_utils.c sr_dumper.c \
47+
sr_arpcache.c sha1.c
48+
49+
sr_OBJS = $(patsubst %.c,%.o,$(sr_SRCS))
50+
sr_DEPS = $(patsubst %.c,.%.d,$(sr_SRCS))
51+
52+
$(sr_OBJS) : %.o : %.c
53+
$(CC) -c $(CFLAGS) $< -o $@
54+
55+
$(sr_DEPS) : .%.d : %.c
56+
$(CC) -MM $(CFLAGS) $< > $@
57+
58+
-include $(sr_DEPS)
59+
60+
sr : $(sr_OBJS)
61+
$(CC) $(CFLAGS) -o sr $(sr_OBJS) $(LIBS)
62+
63+
sr.purify : $(sr_OBJS)
64+
$(PURIFY) $(CC) $(CFLAGS) -o sr.purify $(sr_OBJS) $(LIBS)
65+
66+
.PHONY : clean clean-deps dist
67+
68+
clean:
69+
rm -f *.o *~ core sr *.dump *.tar tags
70+
71+
clean-deps:
72+
rm -f .*.d
73+
74+
dist-clean: clean clean-deps
75+
rm -f .*.swp sr_stub.tar.gz
76+
77+
dist: dist-clean
78+
(cd ..; tar -X stub/exclude -cvf sr_stub.tar stub/; gzip sr_stub.tar); \
79+
mv ../sr_stub.tar.gz .
80+
81+
tags:
82+
ctags *.c
83+
84+
submit:
85+
@tar -czf router-submit.tar.gz $(sr_SRCS) $(sr_HDRS) README Makefile
86+

auth_key

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ophCMr/+(4Plq&pdfSUP@kf*uAUPNCf;/Z}ID[VgBW!7hN3sYf<dHBewu,6C;<}0

logname.pcap

82 Bytes
Binary file not shown.

rtable

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
192.168.2.2 192.168.2.2 255.255.255.255 eth1
2+
172.64.3.10 172.64.3.10 255.255.255.255 eth2
3+
10.0.1.100 10.0.1.100 255.255.255.255 eth3

0 commit comments

Comments
 (0)