Create Multiple Network Interfaces for Docker Container using pipework

23 Mar 2016

Install pipework

sudo bash -c "curl > /usr/local/bin/pipework"
sudo chmod 755 /usr/local/bin/pipework

Create Docker container without network

sudo docker run -itd --name=pg1 --net=none ubuntu

Add network interfaces using pipework

sudo pipework bridge0 -i eth0 pg1 dhclient
sudo pipework bridge1 -i eth1 pg1 dhclient

In the container we can see:

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 22:a5:94:0a:f1:ee
          inet addr:  Bcast:  Mask:
          inet6 addr: fdb2:2c26:f4e4:0:20a5:94ff:fe0a:f1ee/64 Scope:Global
          inet6 addr: fe80::20a5:94ff:fe0a:f1ee/64 Scope:Link
          RX packets:322 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:18358 (18.3 KB)  TX bytes:4348 (4.3 KB)

eth1      Link encap:Ethernet  HWaddr 0e:03:f7:85:b1:db
          inet addr:  Bcast:  Mask:
          inet6 addr: fdb2:2c26:f4e4:1:c03:f7ff:fe85:b1db/64 Scope:Global
          inet6 addr: fe80::c03:f7ff:fe85:b1db/64 Scope:Link
          RX packets:279 errors:0 dropped:0 overruns:0 frame:0
          TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:15828 (15.8 KB)  TX bytes:4190 (4.1 KB)

In the host we can see:

$ sudo brctl show
bridge name bridge id       STP enabled interfaces
bridge0     8000.001c42cedf43   yes     eth0
bridge1     8000.001c42b19231   yes     eth1

Continue Reading →

ONOS Mailing List Useful Article Collection

20 Aug 2015

Many useful articles in ONOS mailing lists are so hard to be found as time goes by.
I gather and cotegorize some of them in this blog post.
NOTE: joining the mailing list is required to view the original posts.

About build, debug, installation, deployment

About application development

About REST/UI development

About ONOS customization

About design of ONOS - north bound

About design of ONOS - core

Continue Reading →

Generates ARP reply using OVS-specific actions

04 Aug 2015

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 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 (
  8. Send the packet back to its input port
mininet> sh ovs-ofctl add-flow s1 "table=0, dl_type=0x0806, nw_dst=, 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
mininet> h1 arp -an

We should see the MAC address of

Continue Reading →

Use Wireshark to Monitor Network Interfaces Created by VMware Fusion

27 Apr 2015

It is a little bit tricky if you want to use wireshark to capture packets on a network interface created by VMware Fusion in Mac OSX. Here are the steps:

Create a FIFO

$ mkfifo /tmp/pcap

Capture packets and pipe to the FIFO using vmnet-sniffer

$ sudo /Applications/VMware\ vmnet8 -e -w /tmp/pcap 

Start Wireshark, reading input from the FIFO

$ sudo wireshark -i /tmp/pcap

Remove the FIFO at the end

$ sudo rm /tmp/pcap

Continue Reading →

Moving from Logdown

11 Feb 2015

Decide to move my blog from Logdown to GitHub Pages for better stability and flexibility. The old posts are completely transferred.

Continue Reading →