V2X Over Ethernet & Virtual Pairs (veth) Tutorial
Without V2X radios, RawLinkLayer can run over a standard Linux Ethernet interface (eth0) or a Linux virtual Ethernet pair (veth). GeoNetworking frames are broadcast with EtherType 0x8947, which reproduces V2X broadcast on a laboratory network.
Important
RawLinkLayer (Python) and the raw link layer of the Rust stack run on Linux and need root privileges or the CAP_NET_RAW capability.
Creating a Virtual Ethernet Pair
Two processes on the same machine can talk over a kernel veth link:
sudo ip link add veth-nodeA type veth peer name veth-nodeB
sudo ip link set veth-nodeA up
sudo ip link set veth-nodeB up
Node A: Python Station
Take the station of the Python Quickstart (v2xflexstack) guide and attach its link layer to veth-nodeA:
from flexstack.linklayer.raw_link_layer import RawLinkLayer
btp_router.freeze_callbacks()
link_layer = RawLinkLayer("veth-nodeA", mac_address, receive_callback=gn_router.gn_data_indicate)
gn_router.link_layer = link_layer
Node B: Rust Station
In a second terminal, run the Rust command-line station (see Rust V2X CLI Tool Tutorial (v2x_cli)) on veth-nodeB:
cd RustFlexstack
sudo cargo run --release --example v2x_cli -- -i veth-nodeB --send cam
Each station receives and decodes the CAMs of the other: the Python station through its LDM subscription, the Rust station in its console. With --security on the Rust side and a secured Python station (Python Security Subsystem) sharing the same certificate chain, the two exchange signed CAMs.
Cleaning Up
sudo ip link delete veth-nodeA