I have an ubuntu 20 system, and I'm trying to create a tunnel between my system and a remote server since my client system can't have any incoming/outgoing TCP traffic.
I created a tun0 virtual interafce and I only want TCP packets to be routed to that interface, so my program could read them, wrap the packet in a different protocol (i.e DNS) and send it to my tunnel endpoint.
I already acheived routing all of the traffic from my computer to the interface, but this will deny my system from doing other non tcp related traffic (like pinging my router, or google.com for example).
The rules I used:
sudo ip route del default
sudo ip route add default via 10.1.0.1 dev tun0
sudo ip route add 192.168.1.127 via 192.168.1.1 dev ens33
Where 192.168.1.1 is my default gw 10.1.0.1 is my tun0 ip 192.168.1.127 is my server's ip
How can I route only tcp traffic?