#!/bin/bash # First, let's identify your network interfaces ip addr show # Create a new routing table for the second interface echo "200 steam2" >> /etc/iproute2/rt_tables # Assuming eth0 is your ethernet and wlan0 is your WiFi # Replace these with your actual interface names from ip addr show ETH="eth0" WIFI="wlan0" # Get the gateway IPs for both interfaces ETH_GATEWAY=$(ip route show dev $ETH | grep default | awk '{print $3}') WIFI_GATEWAY=$(ip route show dev $WIFI | grep default | awk '{print $3}') # Add routes for the second interface ip route add default via $WIFI_GATEWAY dev $WIFI table steam2 # Add rules to use both routing tables ip rule add from $(ip addr show dev $ETH | grep inet | awk '{print $2}') table main ip rule add from $(ip addr show dev $WIFI | grep inet | awk '{print $2}') table steam2 # Enable IP forwarding echo 1 > /proc/sys/net/ipv4/ip_forward # Configure source routing cat > /etc/sysctl.d/90-steam-routing.conf << EOF net.ipv4.conf.all.rp_filter=2 net.ipv4.conf.default.rp_filter=2 net.ipv4.conf.$ETH.rp_filter=2 net.ipv4.conf.$WIFI.rp_filter=2 EOF # Apply sysctl settings sysctl -p /etc/sysctl.d/90-steam-routing.conf # Save the current iptables rules iptables-save > /root/iptables.backup # Add marking rules for Steam traffic iptables -t mangle -A OUTPUT -p tcp --dport 27015:27050 -j MARK --set-mark 0x2 iptables -t mangle -A OUTPUT -p udp --dport 27015:27050 -j MARK --set-mark 0x2 # Save the new iptables rules iptables-save > /etc/iptables/rules.v4