Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6692468
implemented network topo
RafaelSche Apr 30, 2026
f92b683
implemented switches
RafaelSche May 1, 2026
c5370c6
added .gitignore
Arya-55 May 4, 2026
dbfda16
Merge branch 'main' into lab1_switches
Arya-55 May 4, 2026
4529882
implemented tests for switches
RafaelSche May 9, 2026
0ccb14a
added network topo
Arya-55 May 10, 2026
3e95dcb
Merge branch 'lab1_switches' into lab1_router
Arya-55 May 11, 2026
a9aac3b
added entry point and data structures for the router implementation
Arya-55 May 11, 2026
eb59531
added logging and notes on what needs to be done
Arya-55 May 11, 2026
5027f5e
add mac on router links, add readme
alexmupb May 11, 2026
006d611
Update Readme.md: use SwitchFlowTester
RafaelSche May 12, 2026
15a9cfa
disable and drop IPv6
RafaelSche May 12, 2026
c6a8656
log failed rule matches
RafaelSche May 12, 2026
2202c22
switche to mininet logging
RafaelSche May 12, 2026
79ba176
added comments
Arya-55 May 13, 2026
2701217
import protocols
RafaelSche May 13, 2026
d4a8416
function replay packet to in_port
RafaelSche May 13, 2026
db86b4d
prepare packet processing
RafaelSche May 13, 2026
fbd7f38
process arp packets
RafaelSche May 13, 2026
4f90ff1
changed param of function packet_out_to_port()
RafaelSche May 13, 2026
ed3db42
handle ipv4
RafaelSche May 13, 2026
32656f3
Added firewall
Arya-55 May 14, 2026
efc6f73
Added RFC Info to lab1 readme
Arya-55 May 14, 2026
98d3da1
bugfixes
RafaelSche May 14, 2026
082dcb0
pingall is working mostly
RafaelSche May 14, 2026
ac210f6
Fixed firewall and ports, reworked switch logic
Arya-55 May 14, 2026
b354216
Merge branch 'lab1_switches' into lab1_firewall
Arya-55 May 14, 2026
06edc82
TODO: Rework Firewall
Arya-55 May 14, 2026
e31fc20
add timestamp to logging
alexmupb May 15, 2026
bc82a38
fix ping fail from missing icmp in fwd
alexmupb May 15, 2026
1303e80
explicit 0 MAC for arp request, extra logging, document error
alexmupb May 15, 2026
3fc0834
add ping procedure steps
alexmupb May 15, 2026
5900acf
fixed first packet loss on ping
RafaelSche May 15, 2026
518ab30
more logging
RafaelSche May 15, 2026
49e3975
fix typos
alexmupb May 15, 2026
cbe5b98
add OFPActionDecNwTtl action
alexmupb May 15, 2026
f578caa
Merge remote-tracking branch 'origin/lab1_switches' into lab1_firewall
alexmupb May 15, 2026
674e365
fix unneeded lines in merge
alexmupb May 15, 2026
d1149a8
firewall now only blocks ICMP Pings
Arya-55 May 15, 2026
ca3990a
remove more logging
alexmupb May 15, 2026
ce1ee9a
send ICMP unreachable for ICMP messages
alexmupb May 15, 2026
0fffc6f
logs and style corrections
RafaelSche May 16, 2026
59a5585
send icmp network unreachable if network does not exist
RafaelSche May 16, 2026
183668f
more style correcions
RafaelSche May 16, 2026
d6b28d8
new tests in run_network.py
RafaelSche May 16, 2026
0f27fcb
last fixes
RafaelSche May 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.vscode
__pycache__
18 changes: 16 additions & 2 deletions lab0/network_topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,27 @@
#!/usr/bin/python

from mininet.topo import Topo
from mininet.link import TCLink
from mininet.node import OVSBridge

class BridgeTopo(Topo):
"Creat a bridge-like customized network topology according to Figure 1 in the lab0 description."

def __init__(self):

Topo.__init__(self)
def build(self):
hosts = []
for i in range(1, 5):
hosts.append(self.addHost(f"h{i}"))

s1 = self.addSwitch("s1", cls=OVSBridge)
s2 = self.addSwitch("s2", cls=OVSBridge)

links = []
e1 = self.addLink(hosts[0], s1, cls=TCLink, bw=15, delay="10ms")
e2 = self.addLink(hosts[1], s1, cls=TCLink, bw=15, delay="10ms")
e3 = self.addLink(hosts[2], s2, cls=TCLink, bw=15, delay="10ms")
e4 = self.addLink(hosts[3], s2, cls=TCLink, bw=15, delay="10ms")
e5 = self.addLink(s1, s2, cls=TCLink, bw=20, delay="45ms")

# TODO: add nodes and links to construct the topology; remember to specify the link properties

Expand Down
79 changes: 79 additions & 0 deletions lab1/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Readme
First thing in any window: `cd share/ans-ss26-labs/lab1`

In first window: `ryu-manager ans_controller.py` or `ryu-manager ryu.app.ofctl_rest ans_controller.py` to use the `SwitchFlowTester`

In second window: `sudo python3 run_network.py`

From second window once network runs: `xterm h1` (h2, etc) to open host terminals

In second window to restart network: `exit`, then `sudo mn -c`, which also kills the controller

## Common troubleshooting commands
Ping: `h1 ping h2 -c5` , `pingall`

Check TCP/UDP connectivity: `iperf h1 h2 (-u)` , add -u for UDP

See flow tables on node s1: `sudo ovs-ofctl dump-flows s1` (in separate window, not mininet)

# RFC things to look at

[RFC Link](https://datatracker.ietf.org/doc/html/rfc1812)

### Page 39: Packet Drop Action
In the following, the action specified in certain cases is to
silently discard a received datagram. This means that the datagram
will be discarded without further processing **and that the router will
not send any ICMP error message** (see Section [4.3]) as a result.
However, for diagnosis of problems a router SHOULD provide the
capability of logging the error (see Section [1.3.3]), including the
contents of the silently discarded datagram, and SHOULD count
datagrams discarded.

Das heißt: packet drop action = keine extra ICMP error message action

### Page 46: TTL
Note in particular that a router MUST NOT check the TTL of a packet
except when forwarding it.

A router MUST NOT originate or forward a datagram with a Time-to-Live
(TTL) value of zero.

A router MUST NOT discard a datagram just because it was received
with TTL equal to zero or one; if it is to the router and otherwise
valid, the router MUST attempt to receive it.

Auf Page 65 steht auch für IP Forwarding: The forwarder decrements (by at least one)

Das heißt: Jedes packet was der router (controller in unserem fall) forwarded (d.h. nicht selber schreibt) muss ttl-1 haben, aber neue pakete (z.b. ICMP echo) nicht.
Ich glaube aber dass der router die packets schon selber dropped wenn ttl 0 ist, das müssen wir nicht extra als match action rule machen, aber kann man evtl. testen

### Page 49: Router IP origin + broadcast
When a router originates any datagram, the IP source address MUST be
one of its own IP addresses (but not a broadcast or multicast
address). The only exception is during initialization.

For most purposes, a datagram addressed to a broadcast or multicast
destination is processed as if it had been addressed to one of the
router's IP addresses;

### Page 58: ICMP Echo
A router MUST implement an ICMP Echo server function that receives
Echo Requests sent to the router, and sends corresponding Echo
Replies.

The IP source address in an ICMP Echo Reply MUST be the same as the
specific-destination address of the corresponding ICMP Echo Request
message.

Data received in an ICMP Echo Request MUST be entirely included in
the resulting Echo Reply.

### Page 71: Router to Router
Das müssen wir NICHT machen, weil nur 1 router:

When a router is going to forward a packet, it must determine whether
it can send it directly to its destination, or whether it needs to
pass it through another router. If the latter, it needs to determine
which router to use. This section explains how these determinations
are made.
Loading