-
-
Save hadimousavi79/3791bdf2ca587b53ebb0b4ec3daa9a36 to your computer and use it in GitHub Desktop.
6to4 to multiple host
This file contains 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
#!/bin/bash | |
#IRAN | |
# First 6to4 tunnel | |
ip tunnel add 6to4tun_IR mode sit remote 108.1.1.1 local 193.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 | |
# Second 6to4 tunnel | |
ip tunnel add 6to4tun_IR2 mode sit remote 199.1.1.1 local 193.1.1.1 | |
ip -6 addr add 2001:470:1f10:e1f::3/64 dev 6to4tun_IR2 | |
ip link set 6to4tun_IR2 mtu 1480 | |
ip link set 6to4tun_IR2 up | |
# Configure GRE tunnel for each 6to4 tunnel | |
# First GRE tunnel | |
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 | |
# Second GRE tunnel | |
ip -6 tunnel add GRE6Tun_IR2 mode ip6gre remote 2001:470:1f10:e1f::4 local 2001:470:1f10:e1f::3 | |
ip addr add 172.16.2.1/30 dev GRE6Tun_IR2 | |
ip link set GRE6Tun_IR2 mtu 1436 | |
ip link set GRE6Tun_IR2 up | |
iptables -F | |
iptables -P INPUT ACCEPT | |
iptables -P FORWARD ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -I INPUT -p tcp --dport 22 -j ACCEPT | |
iptables -t nat -A PREROUTING -p tcp ! --dport 22 -j DNAT --to-destination 172.16.1.2 | |
configuration in server 2: | |
#kharej1 | |
#!/bin/bash | |
# confige tunnele 6to4 KH | |
ip tunnel add 6to4tun_KH mode sit remote 193.1.1.1 local 108.1.1.1 | |
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 | |
configuration in server 3: | |
#kharej2 | |
#!/bin/bash | |
# confige tunnele 6to4 KH | |
ip tunnel add 6to4tun_KH mode sit remote 193.1.1.1 local 199.247.5.108 | |
ip -6 addr add 2001:470:1f10:e1f::4 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::3 local 2001:470:1f10:e1f::4 | |
ip addr add 172.16.2.2/30 dev GRE6Tun_KH | |
ip link set GRE6Tun_KH mtu 1436 | |
ip link set GRE6Tun_KH up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment