---
# System prepended metadata

title: Mininet 2 /setting Node/link

---

# Mininet 2 /setting Node/link

[TOC]


## 改Node


清空 node info
```
 ifconfig h1-eth0 0
```

設定 Node ip

```
 ip addr add 192.168.1.1/24 brd + dev h1-eth0

```

brd == boradcast 


Node 1
```
 ip addr add 192.168.1.2/24 brd + dev h2-eth0
```

Node 2
```
ip addr add 192.168.1.1/24 brd + dev h1-eth0
```

![](https://i.imgur.com/q4Uflzl.png)

## Analysis Tools 
 
 
 Server 
 ```
 iperf -s -i 1 -u -p 8080
 ```
 
 Client 
 ```
 iperf -c 192.168.1.2 -t 10 -b 10M -u  -p 8080
 ```
  
 ![](https://i.imgur.com/Ub0BXkX.png)




## Configure Link 



### Link Loss Rate

設定 packet loss 的機率

```
mn --link=tc,loss=5
```

tc -> 內建tools 
loss rate = 5%

![](https://i.imgur.com/q4mp5HN.png)

#### Test 

```
 h1 ping -c 1000 -i 0.01 h2
```

![](https://i.imgur.com/iYvVqPV.png)

![](https://i.imgur.com/pbKs7TG.png)



### Link Bandwidth 

![](https://i.imgur.com/rSZWIyv.png)

```
 mn --link=tc,loss=0,bw=5
```
loss Rate = 0%
bandwidth = 5MB/s

#### Test 

Client 以10MB/s Send UDP packets 

client 
```
iperf -c 10.0.0.2 -u -b 10M -t 10
```

listener
```
iperf -s -u -i 1
```

![](https://i.imgur.com/U3YlnnF.png)




---

TCP

client 
```
iperf -c 10.0.0.2 -t 10
```

Listener

```
iperf -s -u -i 1
```

![](https://i.imgur.com/w6KTNYY.png)



### Link Delay (Latency)

![](https://i.imgur.com/1tKablB.png)


![](https://i.imgur.com/kXLdYJc.png)




![](https://i.imgur.com/FSi8wAo.png)
