Tag Archives: network

Idea: Building A Quantum Interface Card (QIC)

A few years ago, an idea came to me regarding quantum entanglement and networking/communication technology.  After some time and research into trying to patent the idea, I found that others had similar ideas but were not at all interested in acting on its development.  To this end, I thought I might share my idea with the world, freely, in the hopes that perhaps someone, someday might find it useful in the furthering of how we not only communicate digitally, but how we share information as a whole.  The idea is as follows and is described using the simplest terms possible not to loose viewers not currently versed in quantum theory.  This post will also contain a simple entanglement primer.

Understanding Quantum Entanglement

To start, one must understand some simple quantum theory observations.  The first, particles entangled at the quantum level, retain their entangled state regardless of distance between said particles.  These particles, share an interesting state which can be described by the following.

Imagine for a moment that in front of you sat a quantum blender.  This magical device would take two particles, blend them up and spit out entangled resulting particles.  Now, imagine that the quantum particles where actually two tennis balls.  One orange and one green.  Once the tennis balls have been placed in the blender and turned on, the resulting particles could be observed as having the following characteristics:

The first ball which was orange, becomes half orange and half green.
The second ball which as green, becomes half green and half orange, in that order and yes, the order does matter and here’s why.

The state of the first tennis ball will always be the exact opposite state of the second and vice versa.  If the first tennis ball is imagined as being rotated 180 degrees, the second tennis ball could be visualized as rotating the opposite direction and have the opposite state.  This is where the importance of quantum communication begins.

If the state of the first tennis ball, when it’s orange state facing you could be thought of as 1, then the opposite state could be expressed as 0.  At the same time that the first ball’s state is 0 the second ball’s  state would be 1.  This is important because synchronization of the two states requires that one end of the entangled particles become inverted or not-ed.  This would render a synchronous state so that when the first tennis ball is facing with a state of 1, the second would also have a state of 1 and once again when changed, vice versa (ie. Orange:1 = Green:1, Orange:0 = Green:0).

Hopefully all of the above helps in understanding of the quantum theory being employed here.  If not, please feel free to ask questions in the comments and I will do my best to answer them.  Also, please keep in mind the idea above is a simplified example to only be used as a reference or mental model for understanding what’s to be explained in the development of a QIC.

Building A Quantum Interface Card (QIC)

In quantum physics it is understood that the sheer act of observing a quantum system changes the state of the system and this must be taken into account.  Currently two large hurdles exist at the time of this writing, the first of which is stabilizing a quantum particle or particles for a long duration of time.  The second, is creating a non-disruptive observance of a quantum particle or at the very least, a system of observance by which the state can be obtained from a quantum system before/during disruption as to obtain the correct state of the particle at the point in time of observance.

The Client Interface

In this model, the client interface could be thought of as a hand held device such as a phone or other user machine such as a desktop/laptop computer, tablet, etc..

The Service Interface

In this model, the service interface could be thought of as the side in which has direct or near direct communication with the service provider or access point into a provider infrastructure such as a data center.

Implementation

The implementation for the QIC requires one or more particles to be entangled at the quantum level and stabilized, with client particle(s) residing in the device used by the end user (ie. phone, tablet, computer, etc.) and the service particles remaining at the data center or provider’s data hub.  Information exchanged from the service end will be instantaneously observed by the client and vice versa.  A protocol will need to be established whereby client communication is recognized and service communication is recognized and handled to avoid collisions.  The simplest approach that comes to mind is to have a series of observed particles dedicated as client to service, and another dedicated as service to client.  This would allow for truly bidirectional and parallel communication.  Information exchanged in this manner could initially be interpreted using simple states such as 1 and 0.  By determining an initial quantum state, any state changes thereafter would determine the transmission state of either 1 or 0 (1 -> 0, 0 -> 1).  Current compression and optimization techniques used for optimizing and encrypting network communication could still be used although, being that this implementation takes place at the quantum level, one might argue that for the time being at least, such techniques may not be necessary for quite some time, if at all.

Realization

Once realized, quantum communication opens up an entirely new avenue of real time information sharing easily measured in the gigabyte, terabyte and potentially in the petabyte per second range.  This caliber of wireless data sharing would allow any device supporting a QIC to download/upload information far beyond what current wired/wireless technology allows, thus putting new bottlenecks on the side of the service provider and the speed in which the client can actually process and persist the data as received.

Other applications for QIC communication go beyond terrestrial technology and into that of deep space communication, allowing instantaneous communication with deep space vehicles and probes.

Conclusion

The above idea expressed reflects my vision for the future of wireless communication in the hopes that it be put into practical use.  If you use this idea, please mention me as one of the authors and I wish you the very best of luck.  Please feel free to ask any questions regarding any of the information listed above.  Thanks.

Visualizing 3D Network Topologies Using Unity

Network topology visualization can be performed using a wide variety of technologies ranging from simple 2D applications to complex 3D applications.  This approach utilizes the Unity (http://unity3d.com/) game engine to develop a network topology visualization in 3D complete with FPS controls in zero gravity and warp to zones.

Demo

Here’s an example of what the end product will look like: View Demo

Screenshots

Unity Topology Screenshot 4 Unity Topology Screenshot 3 Unity Topology Screenshot 2 Unity Topology Screenshot 1

Source Files

The entire Unity project and source files are available for download: Download Unity Topology Source

Layout File Format

Let’s get started, first a data format (or formats) needs to be chosen for loading the layout or topology data.  For my example I have chosen to use GraphML (http://graphml.graphdrawing.org/) being that Unity in C# directly supports XmlDocument.

The GraphML format I am using will support a collection of <node> and <edge> with standard and custom attributes:

<node id="node_1" x="0" y="0" z="0" name="156.145.220.128/25" ... />
<edge id="link_1" source="node_1" target="node_2" ... />

The node defines at the very least the node identifier which will uniquely identify the node in the topology map, the x, y and z which will become our Vector3 coordinates and the name attribute which will become the node label.

The edge defines at the very least the link identifier which will uniquely identify the link in the topology map, the source which identifies the source node of the link and the target which identifies the target node of the link.

Unity Setup

Next let’s define our basic Unity project structure.  Under the Assets folder, create the following subfolders:

  • Data
  • Materials
  • Prefabs
  • Scenes
  • Scripts

Unity - Topology Folders Once we have our basic folder structure setup, let’s create our 2 prefabs we will be using in our project, the Node prefab and the Link prefab.

The Node

Start by creating a new cylinder (GameObject -> Create Other -> Cylinder), size the cylinder down a little to make it look like and adding a Self-Illumin/Diffuse shader.  I made mine blue, however feel free to choose whatever color you wish.  Name the new object “Node”.

Unity - Node

Next add a new script and call it “Node” (Node.cs).  For the script we want to define a basic bit of logic to have our node text always facing the camera and a public string id:

 

using UnityEngine;
using System.Collections;
 
namespace Topology {
 
    public class Node : MonoBehaviour {
 
        public string id;
        public TextMesh nodeText;
 
        void Update () {
            //node text always facing camera
            nodeText.transform.LookAt (Camera.main.transform);
        }
    }
 
}

Add a 3D Text object (GameObject -> Create Other -> 3D Text), move the 3D Text just below the cylinder and move the 3D Text as a child of the Node object.  Next drag the reference into the Node Text (Text Mesh) property.

Unity - Node Properties

Finally drag the “Node” from the Hierarchy window to the “Assets/Prefabs” folder.  Then remove the “Node” object from the Hierarchy view.

The Link

For the link, create an empty game object (GameObject -> Create Empty), name it “Link” and add a new script called “Link” (Link.cs).  Within the script we’ll expose a few public properties such as id, source_id, target_id, etc; and define a LineRenderer which will be used to draw the line connecting the nodes.

 

 

using UnityEngine;
using System.Collections;
 
namespace Topology {
 
    public class Link : MonoBehaviour {
 
        public string id;
        public Node source;
        public Node target;
        public string sourceId;
        public string targetId;
        public string status;
        public bool loaded = false;
 
        private LineRenderer lineRenderer;
 
        void Start () {
            lineRenderer = gameObject.AddComponent<LineRenderer>();
 
            //color link according to status
            Color c;
            if (status == "Up")
                c = Color.gray;
            else
                c = Color.red;
            c.a = 0.5f;
 
            //draw line
            lineRenderer.material = new Material (Shader.Find("Self-Illumin/Diffuse"));
            lineRenderer.material.SetColor ("_Color", c);
            lineRenderer.SetWidth(0.3f, 0.3f);
            lineRenderer.SetVertexCount(2);
            lineRenderer.SetPosition(0, new Vector3(0,0,0));
            lineRenderer.SetPosition(1, new Vector3(1,0,0));
        }
 
        void Update () {
            if(source && target && !loaded){
                //draw links as full duplex, half in each direction
                Vector3 m = (target.transform.position - source.transform.position)/2 + source.transform.position;
                lineRenderer.SetPosition(0, source.transform.position);
                lineRenderer.SetPosition(1, m);
 
                loaded = true;
            }
        }
    }
 
}

Being that this script was a bit larger, I’ll walk through what it does.  First, the public properties; the “id” is the link identifier (ie. “link_1”), the “source” will become the source node reference, the “target” will become the target node, the “sourceId” will hold the id of the source node until the “source” property is populated and the same goes for the “targetId”.  The “status” will hold a value of either “Up” or “Down” and will be used to color the LineRenderer.  Within the “Start()” function, we create a new LineRenderer and color it according to the “status” property value setting its initial line positions to vectors (0,0,0) and (1,0,0) respectively.  The “Update()” method waits until the “source” and “target” properties are populated then sets the LineRenderer end points.  The “loaded” property makes sure this only happens once.

Finally drag the “Link” object from the Hierarchy window to the “Assets/Prefabs” folder.  Then remove the “Link” object from the Hierarchy window.

Controller

Add a new empty game object (GameObject -> Create Empty) and name it “GameController”.  Create a new script called “GameController” (GameController.cs).  This script will be responsible for loading the layout file, creating Nodes and Links and handling general UI updates.

 

using UnityEngine;
using System.Collections;
using System.Xml;
using System.IO;
 
namespace Topology {
 
    public class GameController : MonoBehaviour {
 
        public Node nodePrefab;
        public Link linkPrefab;
 
        private Hashtable nodes;
        private Hashtable links;
        private GUIText statusText;
        private int nodeCount = 0;
        private int linkCount = 0;
        private GUIText nodeCountText;
        private GUIText linkCountText;
 
        //Method for loading the GraphML layout file
        private IEnumerator LoadLayout(){
 
            string sourceFile = Application.dataPath + "/Data/layout.xml";
            statusText.text = "Loading file: " + sourceFile;
 
            //determine which platform to load for
            string xml = null;
            if(Application.isWebPlayer){
                WWW www = new WWW (sourceFile);
                yield return www;
                xml = www.text;
            }
            else{
                StreamReader sr = new StreamReader(sourceFile);
                xml = sr.ReadToEnd();
                sr.Close();
            }
 
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(xml);
 
            statusText.text = "Loading Topology";
 
            int scale = 2;
 
            XmlElement root = xmlDoc.FirstChild as XmlElement;
            for(int i=0; i<root.ChildNodes.Count; i++){
                XmlElement xmlGraph = root.ChildNodes[i] as XmlElement;
 
                for(int j=0; j<xmlGraph.ChildNodes.Count; j++){
                    XmlElement xmlNode = xmlGraph.ChildNodes[j] as XmlElement;
 
                    //create nodes
                    if(xmlNode.Name == "node"){
                        float x = float.Parse(xmlNode.Attributes["x"].Value)/scale;
                        float y = float.Parse (xmlNode.Attributes["y"].Value)/scale;
                        float z = float.Parse(xmlNode.Attributes["z"].Value)/scale;
 
                        Node nodeObject = Instantiate(nodePrefab, new Vector3(x,y,z), Quaternion.identity) as Node;
                        nodeObject.nodeText.text = xmlNode.Attributes["name"].Value;
 
                        nodeObject.id = xmlNode.Attributes["id"].Value;
                        nodes.Add(nodeObject.id, nodeObject);
 
                        statusText.text = "Loading Topology: Node " + nodeObject.id;
                        nodeCount++;
                        nodeCountText.text = "Nodes: " + nodeCount;
                    }
 
                    //create links
                    if(xmlNode.Name == "edge"){
                        Link linkObject = Instantiate(linkPrefab, new Vector3(0,0,0), Quaternion.identity) as Link;
                        linkObject.id = xmlNode.Attributes["id"].Value;
                        linkObject.sourceId = xmlNode.Attributes["source"].Value;
                        linkObject.targetId = xmlNode.Attributes["target"].Value;
                        linkObject.status = xmlNode.Attributes["status"].Value;
                        links.Add(linkObject.id, linkObject);
 
                        statusText.text = "Loading Topology: Edge " + linkObject.id;
                        linkCount++;
                        linkCountText.text = "Edges: " + linkCount;
                    }
 
                    //every 100 cycles return control to unity
                    if(j % 100 == 0)
                        yield return true;
                }
            }
 
            //map node edges
            MapLinkNodes();
 
            statusText.text = "";
        }
 
        //Method for mapping links to nodes
        private void MapLinkNodes(){
            foreach(string key in links.Keys){
                Link link = links[key] as Link;
                link.source = nodes[link.sourceId] as Node;
                link.target = nodes[link.targetId] as Node;
            }
        }
 
        void Start () {
            nodes = new Hashtable();
            links = new Hashtable();
 
            //initial stats
            nodeCountText = GameObject.Find("NodeCount").guiText;
            nodeCountText.text = "Nodes: 0";
            linkCountText = GameObject.Find("LinkCount").guiText;
            linkCountText.text = "Edges: 0";
            statusText = GameObject.Find("StatusText").guiText;
            statusText.text = "";
 
            StartCoroutine( LoadLayout() );
        }
 
    }
 
}

So now time for the walk through.  The 2 public properties nodePrefab and linkPrefab define the prefabs to be used when creating nodes and links.  The 2 Hastables, nodes and links define the collection which will hold the live instances of the prefabs “Node” and “Link”.  The GUIText objects will reference the loading status displayed on the screen, the count of nodes and the count of links.  The nodeCount and linkCount hold the actual numeric values for the count of nodes and links.  The “LoadLayout()” method handles the loading of the GraphML file, it loads the xml file into a string, populates an XmlDocument object and iterates over the <node/> and <edge/> elements.  When a <node /> is encountered we instantiate a Node object and populate its members and same goes for <edge /> with respect to populating a Link.  Once all the “Node” and “Link” objects have been created, the “source” and “target” members of the “Link” object are replaced with the living references of “Node” through the call to “MapLinkNodes()”.  The “Start()” method instantiates the nodes and links Hastables, resets the GUIText objects and starts a coroutine call to “LoadLayout()” which allows for returning control back to the Unity platform and preventing UI lock up.

Next, lets’ add the GUIText objects.  Create a GUIText object for LinkCount, NodeCount and StatusText at a minimum.  Next place the GUIText objects in the Game view to their relative positions.

Unity - Game View

Make these GUIText objects a child of GameController and add drag the references to the GameController script references.

Unity - GameController Hierarchy

Unity - GameController

 Camera

Click on the Main Camera object and add a new script “CameraController” (CameraController.cs).  In this script we’ll add basic controls for WASD, Control, Space and Wheel/Scroll controls.

 

using UnityEngine;
using System.Collections;
 
[AddComponentMenu("Camera-Control/Move ZeroG")]
public class CameraControlZeroG : MonoBehaviour {
 
    public float speed = 5f;
    public GUIText movementSpeed;
 
    private Vector3 move = new Vector3();
    private Vector3 cluster1 = new Vector3(1960, 1791, 2726);
    private Vector3 cluster2 = new Vector3(2042, 1579, 4254);
    private Vector3 cluster3 = new Vector3(2692, 81, 2526);
    private Vector3 cluster4 = new Vector3(531, 2317, 3776);
    private Vector3 cluster5 = new Vector3(-587, 2043, 2194);
 
    void Start(){
        //set to first cluster position
        transform.position = cluster1;
    }
 
    void Update () {
        move.x = Input.GetAxis("Horizontal") * speed * Time.deltaTime;
        move.z = Input.GetAxis("Vertical") * speed * Time.deltaTime;
 
        move.y = 0;
        if (Input.GetKey ("space")) {
            move.y = speed * Time.deltaTime;
        }
 
        if (Input.GetKey ("left ctrl")) {
            move.y = -speed * Time.deltaTime;
        }
 
        //adjust speed with mouse wheel
        speed += Input.GetAxis("Mouse ScrollWheel");
        if (speed < 5)
            speed = 5;
 
        movementSpeed.text = "Move Speed: " + speed;
 
        move = transform.TransformDirection(move);
        transform.position += move;
 
        //set warp to cluster controls
        if(Input.GetKey("1")){
            transform.position = cluster1;
        }
 
        if(Input.GetKey("2")){
            transform.position = cluster2;
        }
 
        if(Input.GetKey("3")){
            transform.position = cluster3;
        }
 
        if(Input.GetKey("4")){
            transform.position = cluster4;
        }
 
        if(Input.GetKey("5")){
            transform.position = cluster5;
        }
    }
}

Walking through the above code, we define 2 public properties, speed which will hold the speed of movement through the zero gravity environment and GUIText movementSpeed which displays our current movement speed.  Next we define a Vector3 for move which will be used as the movement vector.  The following cluster[1-5] members define areas of the Topology which we’ll allow the camera to quickly jump to, feel free to replace these with your own coordinates.  The “Start()” function places our camera at the first cluster position (the largest cluster).  The “Update()” function first updates the move vector to move the camera in a direction.  The “space” check will change our “y” movement upward.  The “left ctrl” changes our “y” movement downward.  The “Mouse ScrollWheel” changes our overall movement speed, then we display the speed in the GUIText.  The final modifications are made to the camera’s transform position.  The GetKey() calls for 1 through 5 warp our camera to the cluster[1-5] positions.

We’ll also want to import a standard asset from the Unity “Character Controller” set.  Click Assets -> Import Package -> Character Controller, deselect everything, then online select “MouseLook.cs”.

Unity - Import Asset

 

This will import the “MouseLook.cs” script which we’ll need to add to the Main Camera (Add Component -> Camera-Control -> Mouse Look).

Putting It All Together

Lastly, build, deploy and check it out.  One thing to keep in mind is that the layout.xml in the Data directory (/Assets/Data/layout.xml) does not get deployed with the build.  You will need to manually copy this file out to your build/deploy directory.  Hopefully you won’t have any errors and will be able to view the 3D topology in all of its beauty and splendor.  Have fun!

Creating Virtual Network Adapters In CentOS

Forward

So here’s the scenario, let’s say for the sake of argument that you have a CentOS linux box running with a single NIC, but you want to have 2 IP addresses assigned to this box (for whatever reason). The following is a step by step guide that will walk you through the process of setting that up.

Getting Started

First, you’ll need to determine the interface name of the network device being used.  For instance, if you’re running a wired ethernet card with a single port, the name is more than likely going to be eth0, if you’re using a wireless card it might be something like wlan0.  First thing you want to do is determine the interface name of this device.  An easy way to do this is to run the following command:

user@computer:$ ifconfig

You should see something similar to the following:

user@computer:$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:3D:2B:AD
inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe3d:2bad/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2855541 errors:0 dropped:0 overruns:0 frame:0
TX packets:1205674 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:412143447 (393.0 MiB) TX bytes:539870133 (514.8 MiB)
Interrupt:75 Base address:0x2024

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4968261 errors:0 dropped:0 overruns:0 frame:0
TX packets:4968261 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2009641198 (1.8 GiB) TX bytes:2009641198 (1.8 GiB)

In this scenario, eth0 is the network interface name and lo is the loopback name.  Now that we know eth0 is the one we want we’ll need to create a virtual device for it (aka. alias).

Create An Network Interface Alias

First, let’s change directory to the network-scripts folder.

user@computer:$ cd /etc/sysconfig/network-scripts/

Next, we’ll copy the ifcfg-<interface_name> to the alias name.

user@computer:$ cp ifcfg-eth0 ifcfg-eth0:0

In this example we are creating a single alias :0 however, you may create as many as you like.  Simply continue to copy the ifcfg-<interface_name> to the desired alias name (ie. ifcfg-eth0:1, ifcfg-eth0:2, etc).

Configure The Alias

Lastly, we need to configure the alias.  This is the step where you physically configure the interface to be static or use DHCP and set the routing information.

For arguments sake let’s configure it to be static.  Open the ifcfg-<interface_name> in the editor of your choice (ie. vi ifcfg-eth0) and set the following.

DEVICE=eth0:0
BOOTPROTO=static
IPADDR=192.168.0.101
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
ONBOOT=yes

Modify each alias configuration file (ie. ifcfg-<interface_name> for each virtual adapter you add) making sure to change the DEVICE, IPADDR, NETMASK and GATEWAY to suit your network.

Once you’ve modified all of the alias configurations for all the aliases you are going to add, restart the network service and you’re good to go.

user@computer:$ service network restart

You can verify that the virtual interfaces are working by pinging each one individually of by running:

user@computer:$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:3D:2B:AD
inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe3d:2bad/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2855541 errors:0 dropped:0 overruns:0 frame:0
TX packets:1205674 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:412143447 (393.0 MiB) TX bytes:539870133 (514.8 MiB)
Interrupt:75 Base address:0x2024

eth0:0 Link encap:Ethernet HWaddr 00:25:90:3B:BB:E4
inet addr:192.168.0.101 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:169 Memory:fb5e0000-fb600000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4968261 errors:0 dropped:0 overruns:0 frame:0
TX packets:4968261 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2009641198 (1.8 GiB) TX bytes:2009641198 (1.8 GiB)