IPv4-in-IPv6 Tunnel: Setup point-to-point tunnel

From OnnoWiki
Jump to navigation Jump to search

Skenario

192.168.100.0/24 -- A 2001::100 -- B 2001::101 B -- 10.10.0.0/24
Gateway A IPv6 2001::100	Tunnel	192.168.100.0/24
Gateway B IPv6 2001::101	Tunnel 10.10.0.0/24

Gateway A

echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
echo 1 > /proc/sys/net/ipv6/conf/default/forwarding
echo 1 > /proc/sys/net/ipv6/conf/enp0s3/forwarding
echo 1 > /proc/sys/net/ipv6/conf/enp0s8/forwarding
echo 1 > /proc/sys/net/ipv6/conf/ip6tnl1/forwarding
echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
echo 1 > /proc/sys/net/ipv4/conf/default/forwarding
echo 1 > /proc/sys/net/ipv4/conf/enp0s3/forwarding
echo 1 > /proc/sys/net/ipv4/conf/enp0s8/forwarding
echo 1 > /proc/sys/net/ipv4/conf/ip6tnl1/forwarding
ip addr add 2001::100/64 dev enp0s3
ip addr add 192.168.100.1/24 dev enp0s8
ip -6 tunnel add ip6tnl1 mode ipip6 remote 2001::101 local 2001::100
ip link set dev ip6tnl1 up
ip route add 10.10.0.0/24 dev ip6tnl1 metric 1

Cek menggunakan perintah berikut

# ip -6 tunnel show
ip6tnl0: ip/ipv6 remote :: local :: encaplimit 4 hoplimit inherit tclass 0x00 flowlabel 0x00000 (flowinfo 0x00000000)
ip6tnl1: ip/ipv6 remote 2001::101 local 2001::100 encaplimit 4 hoplimit 64 tclass 0x00 flowlabel 0x00000 (flowinfo 0x00000000)

Gateway B

echo1 > /proc/sys/net/ipv6/conf/all/forwarding
echo1 > /proc/sys/net/ipv6/conf/default/forwarding
echo1 > /proc/sys/net/ipv6/conf/enp0s3/forwarding
echo1 > /proc/sys/net/ipv6/conf/enp0s8/forwarding
echo1 > /proc/sys/net/ipv6/conf/ip6tnl1/forwarding
echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
echo 1 > /proc/sys/net/ipv4/conf/default/forwarding
echo 1 > /proc/sys/net/ipv4/conf/enp0s3/forwarding
echo 1 > /proc/sys/net/ipv4/conf/enp0s8/forwarding
echo 1 > /proc/sys/net/ipv4/conf/ip6tnl1/forwarding
ip addr add 2001::101/64 dev enp0s3
ip addr add 10.10.0.1/24 dev enp0s8
ip -6 tunnel add ip6tnl1 mode ipip6 remote 2001::100 local 2001::101
ip link set dev ip6tnl1 up
ip route add 192.168.100.0/24 dev ip6tnl1 metric 1

Cek menggunakan perintah berikut:

# ip -6 tunnel show 
ip6tnl0: ip/ipv6 remote :: local :: encaplimit 0 hoplimit inherit tclass 0x00 flowlabel 0x00000 (flowinfo 0x00000000)
ip6tnl1: ip/ipv6 remote 2001::100 local 2001::101 encaplimit 4 hoplimit 64 tclass 0x00 flowlabel 0x00000 (flowinfo 0x00000000)

Cek dari Gateway A

# ping 10.10.0.1




Altrenatif Penjelasan Lain

Cara membuat tunnel device 4over6 (perlu di up sesudahnya)

# /sbin/ip tunnel add <device> mode ip4ip6 remote <ipv6addressofforeigntunnel> local <ipv6addresslocal>

Contoh, misalnya membuat tiga tunnel,

# /sbin/ip -6 tunnel add ip6tnl1 mode ip4ip6 remote <ipv6addressofforeigntunnel1> local <ipv6addresslocal>
# /sbin/ip link set dev ip6tnl1 up 
# /sbin/ip -6 route add <prefixtoroute1> dev ip6tnl1 metric 1
# /sbin/ip -6 tunnel add ip6tnl2 mode ip4ip6 remote <ipv6addressofforeigntunnel2> local <ipv6addresslocal>
# /sbin/ip link set dev ip6tnl2 up
# /sbin/ip -6 route add <prefixtoroute2> dev ip6tnl2 metric 1
# /sbin/ip -6 tunnel add ip6tnl3 mode ip4ip6 remote <ipv6addressofforeigntunnel3> local <ipv6addresslocal>
# /sbin/ip link set dev ip6tnl3 up
# /sbin/ip -6 route add <prefixtoroute3> dev ip6tnl3 metric 1


Pranala Menarik