diff --git a/utils/misc/src/main/java/org/onlab/packet/RIP.java b/utils/misc/src/main/java/org/onlab/packet/RIP.java
new file mode 100644
index 0000000..7fefe40
--- /dev/null
+++ b/utils/misc/src/main/java/org/onlab/packet/RIP.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onlab.packet;
+
+import org.slf4j.Logger;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static org.onlab.packet.PacketUtils.checkInput;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Implements RIP Packet format, according to RFC 2453.
+ */
+
+public class RIP extends BasePacket {
+    /**
+     * Routing Information Protocol packet.
+     * ------------------------------------------ |cmdType (1) | version(1) |
+     * ------------------------------------------ |reserved (2) |
+     * ------------------------------------------ | route entries (n*20) |
+     * ------------------------------------------
+     *
+     */
+    // the case of no RIP entry
+    public static final int MIN_HEADER_LENGTH = 4;
+
+
+    private final Logger log = getLogger(getClass());
+
+    public enum CmdType {
+        RIPREQUEST(1),
+        RIPRESPONSE(2);
+
+        protected int value;
+
+        CmdType(final int value) {
+            this.value = value;
+        }
+
+        public int getValue() {
+            return this.value;
+        }
+
+        public static CmdType getType(final int value) {
+            switch (value) {
+                case 1:
+                    return RIPREQUEST;
+                case 2:
+                    return RIPRESPONSE;
+                default:
+                    return null;
+            }
+        }
+    }
+
+    protected byte cmdType;
+    protected byte version;
+    protected short reserved;
+    protected List<RIPV2Entry> rtEntries = new ArrayList<RIPV2Entry>();
+    protected RIPV2AuthEntry authEntry = null;
+    protected byte[] rawData = null;
+
+    /**
+     * @return the cmdType
+     */
+    public byte getCmdType() {
+        return this.cmdType;
+    }
+
+    /**
+     * @param cmdType
+     *            the cmdType to set
+     * @return this
+     */
+    public RIP setCmdType(final byte cmdType) {
+        this.cmdType = cmdType;
+        return this;
+    }
+
+    /**
+     * @return the version
+     */
+    public byte getVersion() {
+        return this.version;
+    }
+
+    /**
+     * @param version
+     *            the version to set
+     * @return this
+     */
+    public RIP setVersion(final byte version) {
+        this.version = version;
+        return this;
+    }
+
+    /**
+     * @return the reserved short
+     */
+    public short getReserved() {
+        return this.reserved;
+    }
+
+    /**
+     * @param reserved
+     *            the reserved short to set
+     * @return this
+     */
+    public RIP setReserved(final short reserved) {
+        this.reserved = reserved;
+        return this;
+    }
+
+    /**
+     * @return the route entries
+     */
+    public List<RIPV2Entry> getRtEntries() {
+        return this.rtEntries;
+    }
+
+    /**
+     * @param entries
+     *            the route entries to set
+     * @return this
+     */
+    public RIP setRtEntries(final List<RIPV2Entry> entries) {
+        this.rtEntries = entries;
+        return this;
+    }
+    /**
+     * @return the authentication entry
+     */
+    public RIPV2AuthEntry getAuthEntry() {
+        return this.authEntry;
+    }
+
+    /**
+     * @return the raw data of whole RIP packet (after RIP header)
+     */
+    public byte[] getRawData() {
+        return this.rawData;
+    }
+
+    @Override
+    public byte[] serialize() {
+        // not guaranteed to retain length/exact format
+        this.resetChecksum();
+       int dataLength = MIN_HEADER_LENGTH + RIPV2Entry.ENTRY_LEN * rtEntries.size();
+       if (authEntry != null) {
+           dataLength += RIPV2Entry.ENTRY_LEN;
+       }
+        final byte[] data = new byte[dataLength];
+        final ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.put(this.cmdType);
+        bb.put(this.version);
+        bb.putShort(this.reserved);
+        if (authEntry != null) {
+            bb.put(authEntry.serialize());
+        }
+        for (final RIPV2Entry entry : this.rtEntries) {
+            bb.put(entry.serialize());
+        }
+        // assume the rest is padded out with zeroes
+        return data;
+    }
+
+    /**
+     * Deserializer function for RIP packets.
+     *
+     * @return deserializer function
+     */
+    public static Deserializer<RIP> deserializer() {
+        return (data, offset, length) -> {
+            RIP rip = new RIP();
+
+            checkInput(data, offset, length, MIN_HEADER_LENGTH);
+
+            ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
+            rip.rawData = Arrays.copyOfRange(data, offset, offset + length);
+
+
+            rip.cmdType = bb.get();
+            rip.version = bb.get();
+            rip.reserved = bb.getShort();
+
+            // read route entries
+            while (bb.hasRemaining() && (bb.remaining() >= RIPV2Entry.ENTRY_LEN)) {
+                byte[] rtData = new byte[RIPV2Entry.ENTRY_LEN];
+                bb.get(rtData);
+
+                if (rtData[0] == -1 && rtData[1] == -1) {
+                    // second time reaching here is the signature at the end of the packet, don't process it
+                    if (rip.authEntry == null) {
+                        rip.authEntry = RIPV2AuthEntry.deserializer().deserialize(rtData, 0, rtData.length);
+                    }
+                } else {
+                    RIPV2Entry rtEntry = RIPV2Entry.deserializer().deserialize(rtData, 0, rtData.length);
+                    rip.rtEntries.add(rtEntry);
+                }
+            }
+
+            return rip;
+        };
+    }
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return Objects.hash(super.hashCode(), cmdType, reserved, version, authEntry, rtEntries);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof RIP)) {
+            return false;
+        }
+        final RIP that = (RIP) obj;
+
+
+        return super.equals(that) &&
+                Objects.equals(version, that.version) &&
+                Objects.equals(reserved, that.reserved) &&
+                Objects.equals(cmdType, that.cmdType) &&
+                Objects.equals(authEntry, that.authEntry) &&
+                Objects.equals(rtEntries, that.rtEntries);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(getClass())
+                .add("cmdType", Byte.toString(cmdType))
+                .add("version", Byte.toString(version))
+                .add("reserved", Short.toString(reserved))
+                .toString();
+        // TODO: need to handle route entries
+    }
+}
diff --git a/utils/misc/src/main/java/org/onlab/packet/RIPV2AuthEntry.java b/utils/misc/src/main/java/org/onlab/packet/RIPV2AuthEntry.java
new file mode 100644
index 0000000..f77f6dd
--- /dev/null
+++ b/utils/misc/src/main/java/org/onlab/packet/RIPV2AuthEntry.java
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onlab.packet;
+
+import org.slf4j.Logger;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/*
+ * Authentication Entry for RIP version 2 - RFC 2082
+ */
+public class RIPV2AuthEntry extends BasePacket {
+    private static final int ENTRY_LEN = 20;
+    private final Logger log = getLogger(getClass());
+    protected short addressFamilyId;
+    protected short type;
+    protected short offset;
+    protected byte keyId;
+    protected byte authLen;
+    protected int sequence;
+
+
+    @Override
+    public byte[] serialize() {
+        ByteBuffer byteBuffer;
+        byteBuffer = ByteBuffer.allocate(ENTRY_LEN);
+        byteBuffer.putShort(addressFamilyId);
+        byteBuffer.putShort(type);
+        byteBuffer.putShort(offset);
+        byteBuffer.put(keyId);
+        byteBuffer.put(authLen);
+        byteBuffer.putInt(sequence);
+        byteBuffer.putInt(0);
+        byteBuffer.putInt(0);
+        return byteBuffer.array();
+    }
+
+    /**
+     * Deserializer function for RIPv2 entry.
+     *
+     * @return deserializer function
+     */
+    public static Deserializer<RIPV2AuthEntry> deserializer() {
+        return (data, offset, length) -> {
+            RIPV2AuthEntry authEntry = new RIPV2AuthEntry();
+
+            checkNotNull(data);
+
+            if (offset < 0 || length < 0 ||
+                length > data.length || offset >= data.length ||
+                offset + length > data.length) {
+               throw new DeserializationException("Illegal offset or length");
+            }
+            ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
+            if (bb.remaining() < ENTRY_LEN) {
+               throw new DeserializationException(
+                          "Buffer underflow while reading RIP authentication entry");
+            }
+            authEntry.addressFamilyId = bb.getShort();
+            authEntry.type = bb.getShort();
+            authEntry.offset = bb.getShort();
+            authEntry.keyId = bb.get();
+            authEntry.authLen = bb.get();
+            authEntry.sequence = bb.getInt();
+            return authEntry;
+        };
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return Objects.hash(super.hashCode(), sequence, authLen, keyId, offset, addressFamilyId, type);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof RIPV2AuthEntry)) {
+            return false;
+        }
+        final RIPV2AuthEntry that = (RIPV2AuthEntry) obj;
+
+        return super.equals(that) &&
+                Objects.equals(type, that.type) &&
+                Objects.equals(addressFamilyId, that.addressFamilyId) &&
+                Objects.equals(offset, that.offset) &&
+                Objects.equals(keyId, that.keyId) &&
+                Objects.equals(authLen, that.authLen) &&
+                Objects.equals(sequence, that.sequence);
+    }
+
+    /**
+     * @return the Address Family Identifier
+     */
+    public short getAddressFamilyId() {
+        return this.addressFamilyId;
+    }
+
+    /**
+     * @param addressFamilyIdentifier the address family identifier to set
+     * @return this
+     */
+    public RIPV2AuthEntry setAddressFamilyId(final short addressFamilyIdentifier) {
+        this.addressFamilyId = addressFamilyIdentifier;
+        return this;
+    }
+
+    /**
+     * @return the authentication type
+     */
+    public short getType() {
+        return this.type;
+    }
+
+    /**
+     * @param type the authentication type to set
+     * @return this
+     */
+    public RIPV2AuthEntry setType(final short type) {
+        this.type = type;
+        return this;
+    }
+
+    /**
+     * @return the offset of authentication data
+     */
+    public short getOffset() {
+        return this.offset;
+    }
+
+    /**
+     * @param offset the offset of authentication data  to set
+     * @return this
+     */
+    public RIPV2AuthEntry setOffset(final short offset) {
+        this.offset = offset;
+        return this;
+    }
+    /**
+     * @return the subnet mask
+     */
+    public byte getKeyId() {
+        return this.keyId;
+    }
+
+    /**
+     * @param keyId The key id  to set
+     * @return this
+     */
+    public RIPV2AuthEntry setKeyId(final byte keyId) {
+        this.keyId = keyId;
+        return this;
+    }
+
+    /**
+     * @return the authentication data length
+     */
+    public byte getAuthLen() {
+        return this.authLen;
+    }
+
+    /**
+     * @param authlen the length of the authentication data  to set
+     * @return this
+     */
+    public RIPV2AuthEntry setAuthLen(final byte authlen) {
+        this.authLen = authlen;
+        return this;
+    }
+
+
+    /**
+     * @return the sequence number
+     */
+    public int getSequence() {
+        return this.sequence;
+    }
+
+    /**
+     * @param sequencenumber sequence number to set
+     * @return this
+     */
+    public RIPV2AuthEntry setSequenceNumber(final int sequencenumber) {
+        this.sequence = sequencenumber;
+        return this;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "RIPV2AuthEntry [address family Id=" + this.addressFamilyId + ", type=" + this.type
+                + ", offset=" + this.offset
+                + ", key ID=" + this.keyId
+                + ", authentication length = " + this.authLen
+                + ", sequence number=" + this.sequence + "]";
+    }
+}
diff --git a/utils/misc/src/main/java/org/onlab/packet/RIPV2Entry.java b/utils/misc/src/main/java/org/onlab/packet/RIPV2Entry.java
new file mode 100644
index 0000000..20d54e5
--- /dev/null
+++ b/utils/misc/src/main/java/org/onlab/packet/RIPV2Entry.java
@@ -0,0 +1,238 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onlab.packet;
+
+import org.slf4j.Logger;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/*
+ * Entry for RIP version 2 - RFC 2453
+ */
+public class RIPV2Entry extends BasePacket {
+    public static final int ENTRY_LEN = 20;
+    public static final short AFI_IP = 2;
+    public static final byte INFINITY_METRIC = 16;
+    public static final byte NEXTHOP_METRIC =  -128; // actually it is 0xFF
+
+    private final Logger log = getLogger(getClass());
+    protected short addressFamilyId;
+    protected short routeTag;
+    protected Ip4Address ipAddress;
+    protected Ip4Address subnetMask;
+    protected Ip4Address nextHop;
+    protected int metric;
+
+    @Override
+    public byte[] serialize() {
+        ByteBuffer byteBuffer;
+        byteBuffer = ByteBuffer.allocate(ENTRY_LEN);
+        byteBuffer.putShort(addressFamilyId);
+        byteBuffer.putShort(routeTag);
+        byteBuffer.putInt(ipAddress.toInt());
+        byteBuffer.putInt(subnetMask.toInt());
+        byteBuffer.putInt(nextHop.toInt());
+        byteBuffer.putInt(metric);
+        return byteBuffer.array();
+    }
+
+    /**
+     * Deserializer function for RIPv2 entry.
+     *
+     * @return deserializer function
+     */
+    public static Deserializer<RIPV2Entry> deserializer() {
+        return (data, offset, length) -> {
+            RIPV2Entry ripEntry = new RIPV2Entry();
+
+            checkNotNull(data);
+
+            if (offset < 0 || length < 0 ||
+                length > data.length || offset >= data.length ||
+                offset + length > data.length) {
+               throw new DeserializationException("Illegal offset or length");
+            }
+            ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
+            if (bb.remaining() < ENTRY_LEN) {
+               throw new DeserializationException(
+                          "Buffer underflow while reading RIP entry");
+            }
+            ripEntry.addressFamilyId = bb.getShort();
+            // skip the authentication entry
+            if (ripEntry.addressFamilyId == 0xffff) {
+                return ripEntry;
+            }
+            ripEntry.routeTag = bb.getShort();
+            ripEntry.ipAddress = Ip4Address.valueOf(bb.getInt());
+            ripEntry.subnetMask = Ip4Address.valueOf(bb.getInt());
+            ripEntry.nextHop = Ip4Address.valueOf(bb.getInt());
+            ripEntry.metric = bb.getInt();
+            return ripEntry;
+        };
+    }
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return Objects.hash(super.hashCode(), nextHop.toInt(), subnetMask.toInt(),
+                            ipAddress.toInt(), addressFamilyId, metric, routeTag);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof RIPV2Entry)) {
+            return false;
+        }
+        final RIPV2Entry that = (RIPV2Entry) obj;
+
+
+        return super.equals(that) &&
+                Objects.equals(routeTag, that.routeTag) &&
+                Objects.equals(metric, that.metric) &&
+                Objects.equals(addressFamilyId, that.addressFamilyId) &&
+                Objects.equals(ipAddress, that.ipAddress) &&
+                Objects.equals(nextHop, that.nextHop) &&
+                Objects.equals(subnetMask, that.subnetMask);
+    }
+
+
+    /**
+     * @return the Address Family Identifier
+     */
+    public short getAddressFamilyId() {
+        return this.addressFamilyId;
+    }
+
+    /**
+     * @param addressFamilyIdentifier the address family identifier to set
+     * @return this
+     */
+    public RIPV2Entry setAddressFamilyId(final short addressFamilyIdentifier) {
+        this.addressFamilyId = addressFamilyIdentifier;
+        return this;
+    }
+
+    /**
+     * @return the route tag
+     */
+    public short getRouteTag() {
+        return this.routeTag;
+    }
+
+    /**
+     * @param routetag the route tag to set
+     * @return this
+     */
+    public RIPV2Entry setRouteTag(final short routetag) {
+        this.routeTag = routetag;
+        return this;
+    }
+
+    /**
+     * @return the ip address
+     */
+    public Ip4Address getipAddress() {
+        return this.ipAddress;
+    }
+
+    /**
+     * @param ipaddress the Ip Address  to set
+     * @return this
+     */
+    public RIPV2Entry setIpAddress(final Ip4Address ipaddress) {
+        this.ipAddress = ipaddress;
+        return this;
+    }
+    /**
+     * @return the subnet mask
+     */
+    public Ip4Address getSubnetMask() {
+        return this.subnetMask;
+    }
+
+    /**
+     * @param subnetmask the subnet mask  to set
+     * @return this
+     */
+    public RIPV2Entry setSubnetMask(final Ip4Address subnetmask) {
+        this.subnetMask = subnetmask;
+        return this;
+    }
+
+    /**
+     * @return the next hop
+     */
+    public Ip4Address getNextHop() {
+        return this.nextHop;
+    }
+
+    /**
+     * @param nexthop the ip address if the next hop  to set
+     * @return this
+     */
+    public RIPV2Entry setNextHop(final Ip4Address nexthop) {
+        this.nextHop = nexthop;
+        return this;
+    }
+
+
+    /**
+     * @return the metric
+     */
+    public int getMetric() {
+        return this.metric;
+    }
+
+    /**
+     * @param metric the route metric to set
+     * @return this
+     */
+    public RIPV2Entry setMetric(final int metric) {
+        this.metric = metric;
+        return this;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "RIPV2Entry [address family Id=" + this.addressFamilyId + ", route tag=" + this.routeTag
+                + ", Address=" + this.ipAddress
+                + ", Subnet mask=" + this.subnetMask
+                + ", Mext hop=" + this.nextHop
+                + ", metric = " + this.metric + "]";
+    }
+}
diff --git a/utils/misc/src/main/java/org/onlab/packet/RIPng.java b/utils/misc/src/main/java/org/onlab/packet/RIPng.java
new file mode 100644
index 0000000..144302f
--- /dev/null
+++ b/utils/misc/src/main/java/org/onlab/packet/RIPng.java
@@ -0,0 +1,238 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Implemented according to RFC 2080
+ */
+
+package org.onlab.packet;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import static org.onlab.packet.PacketUtils.checkInput;
+import static com.google.common.base.MoreObjects.toStringHelper;
+import org.slf4j.Logger;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Representation of an RIPng Packet.
+ */
+public class RIPng extends BasePacket {
+    /**
+     * Routing Information Protocol Next Generation packet.
+     * ------------------------------------------ |cmdType (1) | version(1) |
+     * ------------------------------------------ |reserved (2) |
+     * ------------------------------------------ | route entries (n*20) |
+     * ------------------------------------------
+     *
+     */
+    // the case of no route entry
+    public static final int MIN_HEADER_LENGTH = 4;
+
+
+    private final Logger log = getLogger(getClass());
+
+    public enum CmdType {
+        RIPngREQUEST(1),
+        RIPngRESPONSE(2);
+
+        protected int value;
+
+        CmdType(final int value) {
+            this.value = value;
+        }
+
+        public int getValue() {
+            return this.value;
+        }
+
+        public static CmdType getType(final int value) {
+            switch (value) {
+                case 1:
+                    return RIPngREQUEST;
+                case 2:
+                    return RIPngRESPONSE;
+                default:
+                    return null;
+            }
+        }
+    }
+
+    protected byte cmdType;
+    protected byte version;
+    protected short reserved;
+    protected List<RIPngEntry> rtEntries = new ArrayList<RIPngEntry>();
+
+    /**
+     * @return the cmdType
+     */
+    public byte getCmdType() {
+        return this.cmdType;
+    }
+
+    /**
+     * @param cmdType
+     *            the cmdType to set
+     * @return this
+     */
+    public RIPng setCmdType(final byte cmdType) {
+        this.cmdType = cmdType;
+        return this;
+    }
+
+    /**
+     * @return the version
+     */
+    public byte getVersion() {
+        return this.version;
+    }
+
+    /**
+     * @param version
+     *            the version to set
+     * @return this
+     */
+    public RIPng setVersion(final byte version) {
+        this.version = version;
+        return this;
+    }
+
+    /**
+     * @return the reserved short
+     */
+    public short getReserved() {
+        return this.reserved;
+    }
+
+    /**
+     * @param reserved
+     *            the reserved short to set
+     * @return this
+     */
+    public RIPng setReserved(final short reserved) {
+        this.reserved = reserved;
+        return this;
+    }
+
+    /**
+     * @return the route entries
+     */
+    public List<RIPngEntry> getRtEntries() {
+        return this.rtEntries;
+    }
+
+    /**
+     * @param entries
+     *            the route entries to set
+     * @return this
+     */
+    public RIPng setRtEntries(final List<RIPngEntry> entries) {
+        this.rtEntries = entries;
+        return this;
+    }
+
+    @Override
+    public byte[] serialize() {
+        // not guaranteed to retain length/exact format
+        this.resetChecksum();
+
+        final byte[] data = new byte[MIN_HEADER_LENGTH + RIPngEntry.ENTRY_LEN * rtEntries.size()];
+        final ByteBuffer bb = ByteBuffer.wrap(data);
+        bb.put(this.cmdType);
+        bb.put(this.version);
+        bb.putShort(this.reserved);
+        for (final RIPngEntry entry : this.rtEntries) {
+            bb.put(entry.serialize());
+        }
+        // assume the rest is padded out with zeroes
+        return data;
+    }
+
+    /**
+     * Deserializer function for RIPng packets.
+     *
+     * @return deserializer function
+     */
+    public static Deserializer<RIPng> deserializer() {
+        return (data, offset, length) -> {
+            RIPng ripng = new RIPng();
+
+            checkInput(data, offset, length, MIN_HEADER_LENGTH);
+
+            ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
+
+            ripng.cmdType = bb.get();
+            ripng.version = bb.get();
+            ripng.reserved = bb.getShort();
+
+            // read route entries
+            while (bb.hasRemaining() && (bb.remaining() >= RIPngEntry.ENTRY_LEN)) {
+                RIPngEntry rtEntry;
+                byte[] rtData = new byte[RIPngEntry.ENTRY_LEN];
+                bb.get(rtData);
+
+                rtEntry = RIPngEntry.deserializer().deserialize(rtData, 0, rtData.length);
+                ripng.rtEntries.add(rtEntry);
+            }
+
+            return ripng;
+        };
+    }
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return Objects.hash(super.hashCode(), cmdType, reserved, version, rtEntries);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof RIPng)) {
+            return false;
+        }
+        final RIPng that = (RIPng) obj;
+
+        return super.equals(that) &&
+                Objects.equals(version, that.version) &&
+                Objects.equals(reserved, that.reserved) &&
+                Objects.equals(cmdType, that.cmdType) &&
+                Objects.equals(rtEntries, that.rtEntries);
+    }
+
+    @Override
+    public String toString() {
+        return toStringHelper(getClass())
+                .add("cmdType", Byte.toString(cmdType))
+                .add("version", Byte.toString(version))
+                .add("reserved", Short.toString(reserved))
+                .toString();
+        // TODO: need to handle route entries
+    }
+}
diff --git a/utils/misc/src/main/java/org/onlab/packet/RIPngEntry.java b/utils/misc/src/main/java/org/onlab/packet/RIPngEntry.java
new file mode 100644
index 0000000..0e4f5c8
--- /dev/null
+++ b/utils/misc/src/main/java/org/onlab/packet/RIPngEntry.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onlab.packet;
+
+import org.slf4j.Logger;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Default DHCP option.
+ */
+public class RIPngEntry extends BasePacket {
+    public static final int OPT_CODE_LEN = 1;
+    public static final int ENTRY_LEN = 20;
+    public static final byte INFINITY_METRIC = 16;
+    public static final byte NEXTHOP_METRIC =  -128; // actually it is 0xFF
+
+    private final Logger log = getLogger(getClass());
+    protected byte[] prefix; // 16 bytes
+    protected short routeTag;
+    protected byte prefixLen;
+    protected byte metric;
+
+    @Override
+    public byte[] serialize() {
+        ByteBuffer byteBuffer;
+        byteBuffer = ByteBuffer.allocate(ENTRY_LEN);
+        byteBuffer.put(prefix);
+        byteBuffer.putShort(routeTag);
+        byteBuffer.put(prefixLen);
+        byteBuffer.put(metric);
+        return byteBuffer.array();
+    }
+
+    /**
+     * Deserializer function for RIPng entry.
+     *
+     * @return deserializer function
+     */
+    public static Deserializer<RIPngEntry> deserializer() {
+        return (data, offset, length) -> {
+            RIPngEntry ripngEntry = new RIPngEntry();
+
+            checkNotNull(data);
+
+            if (offset < 0 || length < 0 ||
+                length > data.length || offset >= data.length ||
+                offset + length > data.length) {
+               throw new DeserializationException("Illegal offset or length");
+            }
+            ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
+            if (bb.remaining() < ENTRY_LEN) {
+               throw new DeserializationException(
+                          "Buffer underflow while reading RIPng entry");
+            }
+            ripngEntry.prefix = new byte[IpAddress.INET6_BYTE_LENGTH];
+            bb.get(ripngEntry.prefix);
+            ripngEntry.routeTag = bb.getShort();
+            ripngEntry.prefixLen = bb.get();
+            ripngEntry.metric = bb.get();
+            return ripngEntry;
+        };
+    }
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return Objects.hash(super.hashCode(), metric, prefixLen, Arrays.hashCode(prefix), routeTag);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof RIPngEntry)) {
+            return false;
+        }
+        final RIPngEntry that = (RIPngEntry) obj;
+
+        return super.equals(that) &&
+                Objects.equals(metric, metric) &&
+                Objects.equals(routeTag, that.routeTag) &&
+                Objects.equals(prefixLen, that.prefixLen) &&
+                Arrays.equals(prefix, that.prefix) &&
+                Objects.equals(routeTag, that.routeTag);
+    }
+    /**
+     * @return the IPv6 prefix
+     */
+    public byte[] getPrefix() {
+        return this.prefix;
+    }
+
+    /**
+     * @param prefix the IPv6 prefix to set
+     * @return this
+     */
+    public RIPngEntry setPrefix(final byte[] prefix) {
+        this.prefix = prefix;
+        return this;
+    }
+
+    /**
+     * @return the route tag
+     */
+    public short getRouteTag() {
+        return this.routeTag;
+    }
+
+    /**
+     * @param routetag the route tag to set
+     * @return this
+     */
+    public RIPngEntry setRouteTag(final short routetag) {
+        this.routeTag = routetag;
+        return this;
+    }
+
+    /**
+     * @return the prefix length
+     */
+    public byte getPrefixLen() {
+        return this.prefixLen;
+    }
+
+    /**
+     * @param prefixlen the prefix length to set
+     * @return this
+     */
+    public RIPngEntry setPrefixLen(final byte prefixlen) {
+        this.prefixLen = prefixlen;
+        return this;
+    }
+
+    /**
+     * @return the metric
+     */
+    public byte getMetric() {
+        return this.metric;
+    }
+
+    /**
+     * @param metric the route metric to set
+     * @return this
+     */
+    public RIPngEntry setMetric(final byte metric) {
+        this.metric = metric;
+        return this;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "RIPngEntry [prefix=" + this.prefix + ", route tag=" + this.routeTag
+                + ", prefix length=" + this.prefixLen
+                + ", metric = " + this.metric + "]";
+    }
+}
diff --git a/utils/misc/src/main/java/org/onlab/packet/UDP.java b/utils/misc/src/main/java/org/onlab/packet/UDP.java
index 9f51713..a5711e7 100644
--- a/utils/misc/src/main/java/org/onlab/packet/UDP.java
+++ b/utils/misc/src/main/java/org/onlab/packet/UDP.java
@@ -35,6 +35,8 @@
                     .put(UDP.DHCP_V6_SERVER_PORT, DHCP6.deserializer())
                     .put(UDP.DHCP_V6_CLIENT_PORT, DHCP6.deserializer())
                     .put(UDP.VXLAN_UDP_PORT, VXLAN.deserializer())
+                    .put(UDP.RIP_PORT, RIP.deserializer())
+                    .put(UDP.RIPNG_PORT, RIPng.deserializer())
                     .build();
 
     public static final int DHCP_SERVER_PORT = 67;
@@ -42,6 +44,8 @@
     public static final int DHCP_V6_SERVER_PORT = 547;
     public static final int DHCP_V6_CLIENT_PORT = 546;
     public static final int VXLAN_UDP_PORT = 4789;
+    public static final int RIP_PORT = 520;
+    public static final int RIPNG_PORT = 521;
 
     private static final short UDP_HEADER_LENGTH = 8;
 
