Skip to content

Instantly share code, notes, and snippets.

@soheilsec
Created November 17, 2023 18:24
Show Gist options
  • Save soheilsec/8e6f54c682ba81756a72f14726eee9f8 to your computer and use it in GitHub Desktop.
Save soheilsec/8e6f54c682ba81756a72f14726eee9f8 to your computer and use it in GitHub Desktop.
6to4 v2ray
#!/bin/bash
ip tunnel add 6to4tun_IR mode sit remote 109.104.154.237 local 37.152.181.148
ip -6 addr add 2001:470:1f10:e1f::1/64 dev 6to4tun_IR
ip link set 6to4tun_IR mtu 1480
ip link set 6to4tun_IR up
# confige tunnele GRE6 ya IPIPv6 IR
ip -6 tunnel add GRE6Tun_IR mode ip6gre remote 2001:470:1f10:e1f::2 local 2001:470:1f10:e1f::1
ip addr add 172.16.1.1/30 dev GRE6Tun_IR
ip link set GRE6Tun_IR mtu 1436
ip link set GRE6Tun_IR up
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -A PREROUTING -j DNAT --to-destination 172.16.1.2
iptables -t nat -A PREROUTING -p tcp --dport 2202 -j DNAT --to-destination 37.152.181.148
iptables -t nat -A POSTROUTING -o GRE6Tun_IR -j MASQUERADE
iptables -A FORWARD -j ACCEPT
sudo sysctl -w net.ipv4.ip_forward=1
echo "net.ipv4.ip_forward=1" > /etc/sysctl.conf
sysctl -p
service iptables save
service iptables restart
service iptables stop
service iptables start
ip tunnel add 6to4tun_KH mode sit remote 37.152.181.148 local 109.104.154.237
ip -6 addr add 2001:470:1f10:e1f::2/64 dev 6to4tun_KH
ip link set 6to4tun_KH mtu 1480
ip link set 6to4tun_KH up
# confige tunnele GRE6 KH using 6to4
ip -6 tunnel add GRE6Tun_KH mode ip6gre remote 2001:470:1f10:e1f::1 local 2001:470:1f10:e1f::2
ip addr add 172.16.1.2/30 dev GRE6Tun_KH
ip link set GRE6Tun_KH mtu 1436
ip link set GRE6Tun_KH up
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -j ACCEPT
sudo sysctl -w net.ipv4.ip_forward=1
echo "net.ipv4.ip_forward=1" > /etc/sysctl.conf
sysctl -p
service iptables save
service iptables restart
service iptables stop
service iptables start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment