.. _ethernet_deployment: ======================================================= 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: .. code-block:: bash 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 :ref:`python_getting_started` guide and attach its link layer to ``veth-nodeA``: .. code-block:: python 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 :ref:`rust_v2x_cli_tutorial`) on ``veth-nodeB``: .. code-block:: bash 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 (:ref:`python_security`) sharing the same certificate chain, the two exchange signed CAMs. Cleaning Up =========== .. code-block:: bash sudo ip link delete veth-nodeA