Professional Documents
Culture Documents
SDN Lab Exp 3C
SDN Lab Exp 3C
Aim:
The aim of this lab is to understand how to view and write flow table rules for a POX
controller using the Mininet network simulator. By completing this lab, you will gain hands-
on experience in inspecting and modifying flow table entries to control network traffic within
a simulated environment.
Materials Required:
In this experiment, we will create a simple network topology using Mininet and use the POX
controller to manage the network. We will then inspect the flow table entries on the switch
and write custom flow table rules using the POX controller to manipulate network traffic.
Experiment Steps:
This command creates a network with one switch and three hosts, with the controller
running remotely.
2. Start the POX Controller:
[bash]
./pox.py forwarding.l2_learning
This command starts the default l2_learning module, which implements a simple MAC-
learning switch.
3. Verify Connectivity:
mininet> h1 ping h2
• In the POX terminal, you will observe log messages indicating the learning process.
• To view the flow table entries on the switch, open a new terminal window.
• Use the following command to dump the flow table entries:
[lua]
This command displays the flow table entries for switch s1.
5. Writing Custom Flow Table Rules:
• Open a text editor and create a new Python file named custom_controller.py.
• Write Python code to implement custom flow table rules. Below is a sample code to
block ICMP traffic between hosts h1 and h2:
[python]
log = core.getLogger()
def _handle_ConnectionUp(event):
log.info("ConnectionUp: %s", event.connection)
msg = of.ofp_flow_mod()
msg.match.dl_type = 0x0800 # IPv4
msg.match.nw_proto = 1 # ICMP
msg.match.nw_src = event.parse_ipv4("10.0.0.1")
msg.match.nw_dst = event.parse_ipv4("10.0.0.2")
msg.actions.append(of.ofp_action_output(port=of.OFPP_NONE))
event.connection.send(msg)
def launch():
core.openflow.addListenerByName("ConnectionUp", _handle_ConnectionUp)
[bash]
./pox.py custom_controller
7. Observing Output:
• Observe the Mininet terminals to see if the ping between hosts h1 and h2 is
successful.
• Use the flow table dumping command to verify if the custom flow table rule has been
applied on the switch.
OUTPUT:
Terminal 1: Mininet
Terminal 2: POX Controller
RESULT:
Through this experiment, we have learned how to view and write flow table rules for
a POX controller using the Mininet network simulator.