Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Gre tunnel for udp traffic
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Gre tunnel for udp traffic

Hey,

so I followed buyvm's tutorial for routing traffic over a gre tunnel (http://wiki.buyvm.net/doku.php/gre_tunnel) and it works fine for tcp ports, but I was unsuccessful in routing udp traffic.
There is a part in the tutorial which shouldn't work for udp, as it forwards all traffic with certain states and udp is stateless.

Now I'm trying to figure out how to forward udp traffic using a gre tunnel.

Any advise is appreciated.

Regards

tr1cky

Comments

  • FrankZFrankZ Veteran
    edited January 2015

    You could try ....

    on the /local/ vps

     
    iptunnel add gre1 mode gre local /local ip/ remote /remote ip/ ttl 255
    ip addr add 192.168.169.1/30 dev gre1
    ip link set gre1 up

    in iptables on /local/ vps add ports you want to forward to tunnel

    -A PREROUTING -p tcp -d /local ip/ --dport 53 -j DNAT --to 192.168.169.2:53
    -A PREROUTING -p udp -d /local ip/ --dport 53 -j DNAT --to 192.168.169.2:53
    -A PREROUTING -p tcp -d /local ip/ --dport 2222 -j DNAT --to 192.168.169.2:22
    and 
    -A POSTROUTING -s 192.168.169.0/24 -j SNAT  --to /local ip/
    and 
    -A INPUT -p gre -s /remote ip/ -j ACCEPT
    
    

    on remote vps

    iptunnel add gre1 mode gre local /remote ip/ remote /local ip/ ttl 255
    ip addr add 192.168.169.2/30 dev gre1
    ip link set gre1 up
    ip route add /local ip/ via /remote vps gateway ip/
    ip route del default
    ip route add default via 192.168.169.1      
    

    on remote VPS add iptable rule

    -A INPUT -p gre -s /local ip/ -j ACCEPT
    

    EDIT: Do not enter the routing tables entries from the BuyVM tutorial.
    Also you will access the remote via the local vps port 2222 for ssh in the above example andyou should set up ssh on the remote to listen on ip 192.168.169.2

    Thanked by 1vimalware
  • MunMun Member

    I do know that it does work with UDP. Can you PM your configs?

    Thanked by 1vimalware
Sign In or Register to comment.