Skip to content

jgiovatto/letce2-emane-example

Repository files navigation

# letce2-emane-example

1) These demo require letce2 and optional mgen-analytics to be installed or sourced in via env

2) You will need to add root and yourself to the appropriate group see scripts/set_frr_groups.sh to run frr router
   for example    frrvty:x:989:frr,root,your_user_name

3) To build config simply type make in the experiment directory

4) to run, letce2 lxc start --scenario-delay=30 and letce2 lxc stop, or use the demo_start.sh and demo_stop.sh scripts

see https://github.com/adjacentlink/letce2

To setup usb to ethernet adapters (adjust ether mac address to match your adapters)
create or edit /etc/udev/rules.d/70-persistent-net.rules/70-persistent-net.rules

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:50:b6:04:04:98", KERNEL=="eth*", NAME="adapt1"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:50:b6:05:7c:85", KERNEL=="eth*", NAME="adapt2"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:50:b6:09:f5:94", KERNEL=="eth*", NAME="adapt3"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:50:b6:08:72:34", KERNEL=="eth*", NAME="adapt4"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="9c:69:d3:39:fe:0f", KERNEL=="eth*", NAME="adapt5"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="9c:69:d3:39:fe:0c", KERNEL=="eth*", NAME="adapt6"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="9c:69:d3:39:fe:73", KERNEL=="eth*", NAME="adapt7"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="9c:69:d3:39:fd:a1", KERNEL=="eth*", NAME="adapt8"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:e0:4c:68:08:f3", KERNEL=="eth*", NAME="adapt9"


---------------- radio with router --------------
This experiment relies on IP forwarding to move traffic from end to end.
The demo has 1 router running in an LXC container attached to 4 radios each running in its own LXC container in a different RF network.
Let PLID be the platform ID (1 router and 4 radios).
Let RFID be the radio network id (1-4)
The router has 1 lan interface 10.101.RFID.1 and 4 wlan interfaces that map to a radio 10.100.RFID.PLID
The IP address for the ethernet adapters are not used since they are used to bridge the external world to the LXC containers.


                                                                           demo-platform 
    _______________________  ________________________________________________________________________________________________________________   ______________________
    |   esternal host 1    | |                  |     (lxc router1)       |    (lxc emane )  |       (lxc router2)        |                  | |   external host 2   |
    |                      | |                  |                         |                  |                            |                  | |                     |
    |                      | |                  |          aveth          |                  |           aveth            |                  | |                     |
    |                      | |       eth        |                wlan1  --|--  radio net 1 --|--  wlan1                   |       eth        | |                     |
    |                      | |      adapt1      |     lan0       wlan2  --|--  radio net 2 --|--  wlan2      lan0         |     adapt2       | |                     |
    |     ip  10.101.1.2 --|-|- xxx.xxx.xxx.x --|-- 10.101.1.1   wlan3  --|--  radio net 3 --|--  wlan3      10.101.2.1 --|-- xxx.xxx.xxx.x -|-|-- 10.101.2.2 ip     |
    |     gw  10.101.1.1   | |                  |                wlan4  --|--  radio net 4 --|--  wlan4                   |                  | |   10.101.2.1 gw     |
    |                      | |                bridge                      |                  |                          bridge               | |                     |
    |                      | |                  |                         |                  |                            |                  | |                     |
    |______________________| |__________________|_________________________|__________________|____________________________|__________________| |_____________________|

1) view containers
# sudo lxc-ls -f
NAME     STATE   AUTOSTART GROUPS IPV4                                                                   IPV6 UNPRIVILEGED 
radio-1  RUNNING 0         -      10.99.0.2                                                              -    false        
radio-10 RUNNING 0         -      10.99.0.13                                                             -    false        
radio-11 RUNNING 0         -      10.99.0.14                                                             -    false        
radio-12 RUNNING 0         -      10.99.0.15                                                             -    false        
radio-13 RUNNING 0         -      10.99.0.12                                                             -    false        
radio-14 RUNNING 0         -      10.99.0.13                                                             -    false        
radio-15 RUNNING 0         -      10.99.0.14                                                             -    false        
radio-16 RUNNING 0         -      10.99.0.15                                                             -    false        
radio-2  RUNNING 0         -      10.99.0.3                                                              -    false        
radio-3  RUNNING 0         -      10.99.0.4                                                              -    false        
radio-4  RUNNING 0         -      10.99.0.5                                                              -    false        
radio-5  RUNNING 0         -      10.99.0.7                                                              -    false        
radio-6  RUNNING 0         -      10.99.0.8                                                              -    false        
radio-7  RUNNING 0         -      10.99.0.9                                                              -    false        
radio-8  RUNNING 0         -      10.99.0.10                                                             -    false        
radio-9  RUNNING 0         -      10.99.0.12                                                             -    false        
router-1 RUNNING 0         -      10.100.1.1, 10.100.2.1, 10.100.3.1, 10.100.4.1, 10.101.1.1, 10.99.0.1  -    false        
router-2 RUNNING 0         -      10.100.1.2, 10.100.2.2, 10.100.3.2, 10.100.4.2, 10.101.2.1, 10.99.0.6  -    false        
router-3 RUNNING 0         -      10.100.1.3, 10.100.2.3, 10.100.3.3, 10.100.4.3, 10.101.3.1, 10.99.0.11 -    false        
router-4 RUNNING 0         -      10.100.1.4, 10.100.2.4, 10.100.3.4, 10.100.4.4, 10.101.4.1, 10.99.0.16 -    false      

2) view container routing table
# ssh node-1 route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use   Iface
10.99.0.0	    0.0.0.0         255.255.255.0   U     0      0        0   backchan0
10.100.1.0	    0.0.0.0         255.255.255.0   U     0      0        0   wan1
10.100.2.0	    0.0.0.0         255.255.255.0   U     0      0        0   wan2
10.100.3.0	    0.0.0.0         255.255.255.0   U     0      0        0   wan3
10.100.4.0	    0.0.0.0         255.255.255.0   U     0      0        0   wan4
10.101.1.0	    0.0.0.0         255.255.255.0   U     0      0        0   lan0
10.101.2.0	    10.100.4.2	    255.255.255.0   UG    20     0        0   wan4
10.101.3.0	    10.100.4.3	    255.255.255.0   UG    20     0        0   wan4
10.101.4.0	    10.100.4.4	    255.255.255.0   UG    20     0        0   wan4

3) brctl show
bridge name	bridge id		STP enabled	interfaces
# platform 1
br_pl_1_lan_1		8000.0050b6087234	no	adapt1
							aveth.17.5

br_pl_1_wf_1		8000.fe17982e0a0f	no	aveth.1.1
							aveth.17.1

br_pl_1_wf_2		8000.fe3f06ef5cd5	no	aveth.17.2
							aveth.5.1

br_pl_1_wf_3		8000.fe88506c471b	no	aveth.17.3
							aveth.9.1

br_pl_1_wf_4		8000.febd86b42723	no	aveth.13.1
							aveth.17.4

# paltform 2
br_pl_2_lan_1		8000.0050b6040498	no	adapt2
							aveth.18.5

br_pl_2_wf_1		8000.fe793d6751d4	no	aveth.18.1
							aveth.2.1

br_pl_2_wf_2		8000.fee60a627df0	no	aveth.18.2
							aveth.6.1

br_pl_2_wf_3		8000.fe0fb623599d	no	aveth.10.1
							aveth.18.3

br_pl_2_wf_4		8000.fe5a6402b40c	no	aveth.14.1
							aveth.18.4

# platform 3
br_pl_3_lan_1		8000.0050b6057c85	no	adapt3
							aveth.19.5

br_pl_3_wf_1		8000.fe8581982e7d	no	aveth.19.1
							aveth.3.1

br_pl_3_wf_2		8000.fe46703022a0	no	aveth.19.2
							aveth.7.1

br_pl_3_wf_3		8000.fe74f1b49303	no	aveth.11.1
							aveth.19.3

br_pl_3_wf_4		8000.fe2c8bdec6a7	no	aveth.15.1
							aveth.19.4

# paltform 4
br_pl_4_lan_1		8000.0050b609f594	no	adapt4
							aveth.20.5

br_pl_4_wf_1		8000.fe563bf0ed65	no	aveth.20.1
							aveth.4.1

br_pl_4_wf_2		8000.fe2918873ab0	no	aveth.20.2
							aveth.8.1

br_pl_4_wf_3		8000.fe0d258cb99d	no	aveth.12.1
							aveth.20.3

br_pl_4_wf_4		8000.fe14540dc9ee	no	aveth.16.1
                                                        aveth.20.4

3) vtysh --vty_socket /var/run/frr/router-1
router-1# sh ip ospf
 OSPF Routing Process, Router ID: 10.101.1.1
 Supports only single TOS (TOS0) routes
 This implementation conforms to RFC2328
 RFC1583Compatibility flag is disabled
 OpaqueCapability flag is disabled
 Initial SPF scheduling delay 0 millisec(s)
 Minimum hold time between consecutive SPFs 50 millisec(s)
 Maximum hold time between consecutive SPFs 5000 millisec(s)
 Hold time multiplier is currently 1
 SPF algorithm last executed 6m58s ago
 Last SPF duration 0.001s
 SPF timer is inactive
 LSA minimum interval 5000 msecs
 LSA minimum arrival 1000 msecs
 Write Multiplier set to 20 
 Refresh timer 10 secs
 Maximum multiple paths(ECMP) supported 8
 Administrative distance 110
 Number of external LSA 0. Checksum Sum 0x00000000
 Number of opaque AS LSA 0. Checksum Sum 0x00000000
 Number of areas attached to this router: 1
 Area ID: 0.0.0.0 (Backbone)
   Number of interfaces in this area: Total: 5, Active: 5
   Number of fully adjacent neighbors in this area: 8
   Area has no authentication
   SPF algorithm executed 27 times
   Number of LSA 8
   Number of router LSA 4. Checksum Sum 0x000235e6
   Number of network LSA 4. Checksum Sum 0x00023733
   Number of summary LSA 0. Checksum Sum 0x00000000
   Number of ASBR summary LSA 0. Checksum Sum 0x00000000
   Number of NSSA LSA 0. Checksum Sum 0x00000000
   Number of opaque link LSA 0. Checksum Sum 0x00000000
   Number of opaque area LSA 0. Checksum Sum 0x00000000


---------------- layer2 multi channel --------------
This experiment relies on bridging to connect external hosts as if they were on the same subnet.
Each external node connects to a real ethernet interface which is bridged to an LXC container that runs EMANE.
Each EMANE will read the ethernet frame from the aveth inteface and send it OTA to the other EMANE node(s) which will forward the frame out to the external host.
There are (4) external interfaces per platform. Each interface is bridge to an LXC container running an EMANE network.

external platform 1                                     demo-platform                                external platform 2
_______________________ ____________________________________________________________________________ _____________________
|                     | |                |               (lxc emane )               |              | |                    |
|                     | |       eth      |    aveth                        aveth    |     eth      | |                    |
|   ip 10.101.1.1 ----|-|----  adapt1 ------- lan0  ----  radio net 1 ----  lan0 ------ adapt5 ----|-|---- 10.101.1.2 ip  |
|                     | |                |                                          |              | |                    |
|   ip 10.101.2.1 ----|-|----  adapt2 ------- lan0  ----  radio net 2 ----  lan0 ------ adapt6 ----|-|---- 10.101.2.2 ip  |
|                     | |                |                                          |              | |                    |
|   ip 10.101.3.1 ----|-|----  adapt3 ------- lan0  ----  radio net 3 ----  lan0 ------ adapt7 ----|-|---- 10.101.3.2 ip  |
|                     | |                |                                          |              | |                    |
|   ip 10.101.4.1 ----|-|----  adapt4 ------- lan0  ----  radio net 4 ----  lan0 ------ adapt8 ----|-|---- 10.101.4.2 ip  |
|                     | |                |                                          |              | |                    |
|                     | |             bridge                                     bridge            | |                    |
|                     | |                |                                          |              | |                    |
|_____________________| |________________|__________________________________________|______________| |____________________|

1) brctl show

# paltform 1
br_pl_1_wf_1		8000.0050b6087234	no	adapt1
                					aveth.1.1

br_pl_1_wf_2		8000.0050b6040498	no	adapt2
				                	aveth.2.1

br_pl_1_wf_3		8000.0050b6057c85	no	adapt3
                					aveth.3.1

br_pl_1_wf_4		8000.0050b609f594	no	adapt4
				                	aveth.4.1


# platform 2
br_pl_2_wf_1		8000.9c69d339fe0f	no	adapt5
						       	aveth.5.1

br_pl_2_wf_2		8000.9c69d339fe0c	no	adapt6
                					aveth.6.1

br_pl_2_wf_3		8000.9c69d339fe73	no	adapt7
				                	aveth.7.1

br_pl_2_wf_4		8000.9c69d339fda1	no	adapt8
                					aveth.8.1

Notes on using vlans instead of multiple physical USB NIC devices

# 1. Create the VLAN connection (e.g., VLAN 100 on eth0)
sudo nmcli con add type vlan con-name VLAN100 dev eth0 id 100
# Or using ifname if you prefer:
# sudo nmcli con add type vlan ifname eth0.100 id 100

# 2. Bring the new VLAN connection up
sudo nmcli con up VLAN100
# You might need to add IP address info here (static/DHCP) if not bridging
# sudo nmcli con modify VLAN100 ipv4.method manual ipv4.addresses 192.168.100.1/24


# 1. Create a bridge (e.g., br-vlan100)
sudo nmcli con add type bridge con-name br-vlan100 ifname br-vlan100

# 2. Add the VLAN interface as a slave to the bridge
sudo nmcli con add type bridge-slave con-name br-vlan100-slave ifname eth0.100 master br-vlan100

# 3. Bring bridge and slave up (if not already)
sudo nmcli con up br-vlan100
sudo nmcli con up br-vlan100-slave

# Inside /var/lib/lxc/your-container/config
lxc.net.0.type = veth
lxc.net.0.link = br-vlan100 # Connect to the bridge we created
lxc.net.0.flags = up
lxc.net.0.name = eth0 # Container's interface name

# Optional: Add static IP for the container
lxc.net.0.ipv4.address = 192.168.100.10/24
# lxc.net.0.ipv4.gateway = 192.168.100.1 # If using DHCP or gateway

About

simple container setup for emane using letce2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published