enabling hardware offloads disables NAT forwarding [SOLVED]

Started by crankshaft, December 14, 2024, 08:30:49 AM

Previous topic - Next topic
See this post: https://forum.opnsense.org/index.php?topic=44633.0

I have spent days trying to solve my upload problems, turns out by switching off these, the upload problem was solved immediately.

But that has now disabled all NAT and none of my NAT rules will work.

Is this a bug ?

More evidence of an issue:

# dmesg | grep vtnet
vtnet0: <VirtIO Networking Adapter> on virtio_pci3
vtnet0: Ethernet address: bc:24:11:97:50:ec
vtnet0: netmap queues/slots: TX 1/256, RX 1/512
000.000765 [ 452] vtnet_netmap_attach       vtnet attached txq=1, txd=256 rxq=1, rxd=512
vtnet1: <VirtIO Networking Adapter> on virtio_pci4
vtnet1: Ethernet address: 02:00:00:04:a2:11
vtnet1: netmap queues/slots: TX 1/256, RX 1/512
000.000766 [ 452] vtnet_netmap_attach       vtnet attached txq=1, txd=256 rxq=1, rxd=512
vtnet0: link state changed to UP
vtnet1: link state changed to UP
vtnet0: <VirtIO Networking Adapter> on virtio_pci3
vtnet0: Ethernet address: bc:24:11:97:50:ec
vtnet0: netmap queues/slots: TX 1/256, RX 1/512
000.000765 [ 452] vtnet_netmap_attach       vtnet attached txq=1, txd=256 rxq=1, rxd=512
vtnet1: <VirtIO Networking Adapter> on virtio_pci4
vtnet1: Ethernet address: 02:00:00:04:a2:11
vtnet1: netmap queues/slots: TX 1/256, RX 1/512
000.000766 [ 452] vtnet_netmap_attach       vtnet attached txq=1, txd=256 rxq=1, rxd=512
vtnet0: link state changed to UP
vtnet1: link state changed to UP
vtnet0: vtnet_update_rx_offloads: cannot update Rx features
vtnet0: vtnet_update_rx_offloads: cannot update Rx features
vtnet1: vtnet_update_rx_offloads: cannot update Rx features
vtnet1: vtnet_update_rx_offloads: cannot update Rx features
[/code'

December 15, 2024, 04:21:21 AM #2 Last Edit: December 15, 2024, 04:24:21 AM by crankshaft
Fixed.

Created a startup script to pass the following to vtnet1:

ifconfig vtnet1 rxcsum -txcsum rxcsum6 -txcsum6 -tso lro

Now I have full bandwidth and NAT is restored.

#!/bin/bash
## /root/offload.sh

DIR="/usr/share/mydir"
IF="vtnet1"

# Create the directory if it doesn't exist
mkdir -p $DIR

# Create the disable_offloading.sh script
cat << EOF > $DIR/disable_offloading.sh
#!/bin/sh
# Loop until $IF is up
while ! ifconfig $IF | grep -q "status: active"; do
    sleep 1
done
# Wait 500ms after $IF is up
sleep 0.5
# Disable offload settings for $IF
ifconfig $IF rxcsum -txcsum rxcsum6 -txcsum6 -tso lro
EOF

# Create the $IF_up.conf file
cat << EOF > /etc/devd/${IF}_up.conf
notify 10 {
    match "system"        "IFNET";
    match "subsystem"     "$IF";
    action "$DIR/disable_offloading.sh && touch /tmp/${IF}_offload";
};
EOF

# Make the disable_offloading.sh script executable
chmod +x $DIR/disable_offloading.sh