In this article, we are going to make a fake router using OpenvSwitch without the help of SDN controllers.
Two OVS-specific actions are used: move and load.

Assume the IP and MAC address of the router are 10.0.0.254 and 01:23:45:67:89:ab respectively.
Following are the detail steps:

  1. Set ARP opcode to 0x2 (ARP reply)
  2. Destination MAC := Source MAC
  3. Source MAC := MAC address of router (01:23:45:67:89:ab)
  4. ARP destination hardware address := ARP source hardware address
  5. ARP source hardware address := MAC address of router (01:23:45:67:89:ab)
  6. ARP destination network address := ARP source network address
  7. ARP source network address := IP address of router (10.0.0.254)
  8. Send the packet back to its input port
mininet> sh ovs-ofctl add-flow s1 "table=0, dl_type=0x0806, nw_dst=10.0.0.254, actions=load:0x2->NXM_OF_ARP_OP[], move:NXM_OF_ETH_SRC[]->NXM_OF_ETH_DST[], mod_dl_src:01:23:45:67:89:ab, move:NXM_NX_ARP_SHA[]->NXM_NX_ARP_THA[], move:NXM_OF_ARP_SPA[]->NXM_OF_ARP_TPA[], load:0x0123456789ab->NXM_NX_ARP_SHA[], load:0x0a0000fe->NXM_OF_ARP_SPA[], in_port"

We can test the it by following commands:

mininet> h1 ping -c1 -W1 10.0.0.254
mininet> h1 arp -an

We should see the MAC address of 10.0.0.254