Junos Network Configuration Examples and Mininet-WiFi Mobility Tests
Initial VLAN and L3 Interface Configuration
This section outlines the basic configuration for DATA (VLAN 10) and VOICE (VLAN 20) VLANs, including L3 interfaces.
set vlans DATA vlan-id 10
set vlans VOICE vlan-id 20
set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members DATA
set interfaces ge-0/0/5 unit 0 family ethernet-switching vlan members VOICE
set interfaces vlan unit 10 family inet address 192.168.3.1/24
set interfaces vlan unit 20 family inet address 192.168.4.1/24
set vlans DATA l3-interface vlan.10
set vlans VOICE l3-interface vlan.20
VLAN Configuration for Two Devices
Device 1: EX-C2 Configuration
#EX-C2
set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members DATA
set interfaces ge-0/0/5 unit 0 family ethernet-switching vlan members VOICE
set interfaces ge-0/0/23 unit 0 family inet address 20.20.20.2/30
set interfaces vlan unit 10 family inet address 192.168.3.1/24
set interfaces vlan unit 20 family inet address 192.168.4.1/24
set routing-options static route 0.0.0.0/0 next-hop 20.20.20.1
set vlans DATA vlan-id 10
set vlans DATA l3-interface vlan.10
set vlans VOICE vlan-id 20
set vlans VOICE l3-interface vlan.20
Device 2: EX-D1 Configuration
#EX-D1
set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members study
set interfaces ge-0/0/5 unit 0 family ethernet-switching vlan members teach
set interfaces ge-0/0/23 unit 0 family inet address 20.20.20.1/30
set interfaces vlan unit 1 family inet address 192.168.1.1/24
set interfaces vlan unit 2 family inet address 192.168.2.1/24
set routing-options static route 0.0.0.0/0 next-hop 20.20.20.2
set vlans study vlan-id 1
set vlans study l3-interface vlan.1
set vlans teach vlan-id 2
set vlans teach l3-interface vlan.2
OSPF Routing Protocol Setup
OSPF Configuration – Device 1
set interfaces ge-0/0/0 unit 0 family inet address 10.10.10.1/24
set interfaces ge-0/0/1 unit 0 family inet address 10.10.10.2/24
set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members VOICE
set interfaces vlan unit 10 family inet address 192.168.1.1/24
set protocols ospf area 0.0.0.10 interface ge-0/0/0.0 metric 5
set protocols ospf area 0.0.0.10 interface ge-0/0/1.0 metric 10
set protocols ospf area 0.0.0.10 interface vlan.10
set vlans VOICE vlan-id 10
set vlans VOICE l3-interface vlan.10
OSPF Configuration – Device 2
set interfaces ge-0/0/0 unit 0 family inet address 10.10.10.8/24
set interfaces ge-0/0/1 unit 0 family inet address 10.10.10.7/24
set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members DATA
set interfaces vlan unit 20 family inet address 172.16.1.1/24
set protocols ospf area 0.0.0.10 interface ge-0/0/0.0 metric 5
set protocols ospf area 0.0.0.10 interface ge-0/0/1.0 metric 10
set protocols ospf area 0.0.0.10 interface vlan.20
set vlans DATA vlan-id 20
set vlans DATA l3-interface vlan.20
Internal BGP (iBGP) Setup Between Two Devices
iBGP Configuration – Device 1 (AS 2000)
set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members study
set interfaces ge-0/0/23 unit 0 family inet address 20.20.20.1/30
set interfaces vlan unit 1 family inet address 192.168.1.1/24
set routing-options autonomous-system 2000
set protocols bgp group BGP_INT type internal
set protocols bgp group BGP_INT export ADVERTISE_INT
set protocols bgp group BGP_INT peer-as 2000
set protocols bgp group BGP_INT neighbor 20.20.20.2
set policy-options policy-statement ADVERTISE_INT term 1 from protocol bgp
set policy-options policy-statement ADVERTISE_INT term 1 then accept
set policy-options policy-statement ADVERTISE_INT term 2 from protocol direct
set policy-options policy-statement ADVERTISE_INT term 2 then accept
set policy-options policy-statement ADVERTISE_INT term 3 then reject
set vlans study vlan-id 1
set vlans study l3-interface vlan.1
iBGP Configuration – Device 2 (AS 2000)
set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members DATA
set interfaces ge-0/0/23 unit 0 family inet address 20.20.20.2/30
set interfaces vlan unit 10 family inet address 192.168.3.1/24
set routing-options autonomous-system 2000
set protocols bgp group INT-BGP type internal
Mininet-WiFi Experiment Setup
Common Skeleton (Use in All Experiments)
from mininet.node import Controller
from mn_wifi.net import Mininet_wifi
from mn_wifi.cli import CLI
from mn_wifi.link import wmediumd
from mn_wifi.wmediumdConnector import interference
from mininet.log import setLogLevel
import time
setLogLevel('info')
def topology():
net = Mininet_wifi(controller=Controller, link=wmediumd,
wmediumd_mode=interference)
c0 = net.addController('c0')
# Add APs and STAs here
net.configureWifiNodes()
net.build()
c0.start()
# ap1.start([c0])
time.sleep(10)
net.stop()
if __name__ == '__main__':
topology()
Quick Add-on Snippets for Mininet-WiFi
These snippets can be integrated into the topology()
function below the AP and STA definitions.
- Exp 1: Basic iPerf Test: AP1 + STA1 (A), STA2 (G), STA3 (N). Use
iperf -s
andiperf -c
. - Exp 2: RTS/CTS Testing: Set RTS threshold using
iwconfig rts 100
, then run iPerf UDP test. - Exp 3: Distance and SNR Impact: Position STA1 near and STA2 far from the AP, then run
iperf -u
to measure performance differences. - Exp 4: Concurrent Traffic Load: Use 5 STAs, all connecting to the AP, running concurrent
iperf -u -b 5M
sessions. - Exp 5: Packet Loss Simulation: Apply traffic control (TC) to simulate loss:
tc qdisc loss 50%
. Test throughput using iPerf (STA1 -> STA2). - Exp 6: Mobility Simulation (Simple Handover): Use
sta1.setPosition()
to simulate movement, triggering a handover from AP1 to AP2. - Exp 7: Handover Delay Measurement: Log ping results while moving STA1 from AP1 to AP2 to measure handover delay.
- Exp 8: UDP Handover Test: STA1 sends UDP traffic to H1, and a handover occurs midway through the transmission.
- Exp 9: Video Streaming Handover: STA1 streams video from a server while moving across multiple APs.
- Exp 10: TX Power Reduction: Iterate through a range of reduced transmit power settings to observe reassociation behavior.
- Exp 11: Linear Handover Logging: Set up 3 APs in a line. Move STA1 linearly (e.g., x=0 to x=120) and log handover events.