Skip to content

Using Simu5G for real-time simulation #281

@zhanzhowwm

Description

@zhanzhowwm

Hello,

I am attempting to use Simu5G for real-time simulation. I modify the extclientserver example code in the emulation. Specifically, I am using Host A with two network cards. One of the network cards is used to connect to another host B in the local area network (192.168.3.0/24), and the other network card connects to the gateway (192.168.2.10) for Internet access. Theoretically, the hosts in the local area network can access the Internet through the simulated 5G network.

The current problem is that I can use the local host to ping the IP address of the UE (192.168.3.1) in Simu5G, but I cannot ping the IP address of the gNB (10.0.1.2), and I cannot observe any traffic on the external network card.

I enabled IP forwarding on Host A and configured NAT rules. When simu5G is not enabled, local host B can access the Internet.

My configuration is shown below:

sudo ip link add sim-veth1 type veth peer name ext-veth1
sudo ip link add sim-veth2 type veth peer name ext-veth2

sudo ip link set sim-veth1 up
sudo ip link set sim-veth2 up
sudo ip link set ext-veth1 up
sudo ip link set ext-veth2 up

sudo ip link add name br-client type bridge
sudo ip link set ext-veth1 master br-client

sudo ip link add name br-server type bridge
sudo ip link set ext-veth2 master br-server

sudo ip link set br-client up
sudo ip link set br-server up
sudo ip link set enx00e04c36136b up
sudo ip link set enxc8a362edbde2 up

sudo ip addr add 192.168.3.2/24 dev br-client
sudo ip addr add 192.168.2.2/24 dev br-server

# Add route to gateway
sudo ip route add default via 192.168.2.10 dev br-server

sudo ip link set enxc8a362edbde2 master br-server
sudo ip link set enx00e04c36136b master br-client

sudo iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -o br-server -j MASQUERADE

I enabled simu5G and disabled the network card routing on Host A (while still keeping ip forwarding enabled) to ensure that all traffic passed through simu5G:

sudo iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -o br-server -j MASQUERADE

sudo iptables -A FORWARD -i br-client -o br-server -j DROP
sudo iptables -A FORWARD -i br-server -o br-client -j DROP

I have checked the mrt file of simu5G. The routing rules in it are correct. Maybe there is a problem with other configurations?
I am willing to provide any configuration file used if it is useful.
Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions