# mininet

***

> An Instant Virtual Network on your Laptop (or other PC)

## 1. Download/Get Started With Mininet

### Option 2: Native Installation from Source

```bash
$ git clone git://github.com/mininet/mininet
$ cd mininet
$ git tag   # list available versions
$ git checkout -b 2.2.2rc1 2.2.2rc1 # or whatever version you wish to install
$ cd ..
$ mininet/util/install.sh -a
```

## 2. Mininet Usage

* `$` preceeds Linux commands that should be typed at the shell prompt
* `mininet>` preceeds Mininet commands that should be typed at Mininet’s CLI,
* `#` preceeds Linux commands that are typed at a root shell prompt

```bash
$ sudo bash
# mn --help
```

```bash
# mn
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2
*** Adding switches:
s1
*** Adding links:
(h1, s1) (h2, s1)
*** Configuring hosts
h1 h2
*** Starting controller
c0
*** Starting 1 switches
s1 ...
*** Starting CLI:
```

```bash
mininet> nodes
available nodes are:
c0 h1 h2 s1
mininet> pingall
*** Ping: testing ping reachability
h1 -> h2
h2 -> h1
*** Results: 0% dropped (2/2 received)
mininet> h1 ping h2
mininet> h1 ping s1
mininet> h1 ifconfig
mininet> s1 ifconfig
```

```bash
mininet> exit
*** Stopping 1 controllers
c0
*** Stopping 2 links
..
*** Stopping 1 switches
s1
*** Stopping 2 hosts
h1 h2
*** Done
```

## 3. Mininet connect to OpenDaylight

```bash
# mn --controller=remote,ip=192.168.250.8 --topo=tree,1,3 --mac
*** Creating network
*** Adding controller
Unable to contact the remote controller at 192.168.250.8:6653
Unable to contact the remote controller at 192.168.250.8:6633
Setting remote controller to 192.168.250.8:6653
*** Adding hosts:
h1 h2 h3
*** Adding switches:
s1
*** Adding links:
(s1, h1) (s1, h2) (s1, h3)
*** Configuring hosts
h1 h2 h3
*** Starting controller
c0
*** Starting 1 switches
s1 ...
*** Starting CLI:

mininet> net
h1 h1-eth0:s1-eth1
h2 h2-eth0:s1-eth2
h3 h3-eth0:s1-eth3
s1 lo:  s1-eth1:h1-eth0 s1-eth2:h2-eth0 s1-eth3:h3-eth0
c0

mininet> links
s1-eth1<->h1-eth0 (OK OK)
s1-eth2<->h2-eth0 (OK OK)
s1-eth3<->h3-eth0 (OK OK)

mininet> dpctl dump-flows

mininet> dump
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zhaojunhhhu.gitbook.io/learn/chapter5/mininet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
