Created
February 9, 2024 09:02
-
-
Save soheilsec/a5ae319d596a72a0bfc7b353b7481764 to your computer and use it in GitHub Desktop.
6to4 for Openvpn & cisco
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Openvpn / cisco | |
#IRAN | |
#!/bin/bash | |
ip tunnel add 6to4tun_IR mode sit remote 65.21.4.49 local 185.1.1.1 | |
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 -I INPUT -p tcp --dport 2202 -j ACCEPT | |
iptables -I INPUT -p tcp --dport 528 -j ACCEPT | |
#openvpn | |
iptables -t nat -A POSTROUTING -s 10.8.0.0/16 -j SNAT --to-source 172.16.1.1 | |
#cisco | |
iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -j SNAT --to-source 172.16.1.1 | |
#iptables -t nat -A PREROUTING -i ens160 -j DNAT --to-destination 172.16.1.2 | |
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 | |
#openvpn | |
sudo echo "200 iprange" >> /etc/iproute2/rt_tables | |
sudo ip rule add from 10.8.0.0/16 table iprange | |
sudo ip route add default via 172.16.1.2 dev GRE6Tun_IR table iprange | |
sudo iptables -t mangle -A PREROUTING -s 10.8.0.0/16 -j MARK --set-mark 200 | |
#cisco | |
sudo echo "300 iprange" >> /etc/iproute2/rt_tables | |
sudo ip rule add from 192.168.0.0/16 table iprange | |
sudo ip route add default via 172.16.1.2 dev GRE6Tun_IR table iprange | |
sudo iptables -t mangle -A PREROUTING -s 192.168.0.0/16 -j MARK --set-mark 200 | |
service iptables save | |
service iptables restart | |
service iptables stop | |
service iptables start | |
#kharej | |
#!/bin/bash | |
# confige tunnele 6to4 KH | |
ip tunnel add 6to4tun_KH mode sit remote 185.1.1.1 local 65.21.4.49 | |
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 |
Hi, i did not make video for it.
but the play list for tunnels tut
راه اندازی شبکه امن لینوکس
https://www.youtube.com/playlist?list=PLwq8--jsXOEmw6ieDg5PsOjzNUtb5WVYq
…On Wed, 25 Dec 2024 at 22:04, Tesla2550 ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Does this have a link to your YouTube tutorial?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/soheilsec/a5ae319d596a72a0bfc7b353b7481764#gistcomment-5360907>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4CIZM2K4X2Z7QM4UBNWWFT2HL3EFBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTEOBSGI2TEOBWU52HE2LHM5SXFJTDOJSWC5DF>
.
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this have a link to your YouTube tutorial?