refer:
Tunnelling IPv4/IPv6
Configured tunnels
FreeBSD supports configured tunnels with the gif tunnel-interface. Setting up a manual tunnel requires several steps on the command line.
Beforehand, you need the following information:
- $host-ipv4
- IPv4-address of the host
- $router-ipv4
- IPv4-address of the router/tunnel-server
- $tunnel-v6host
- (Tunnel) IPv6-address of the host
- $tunnel-v6router
- (Tunnel) IPv6-address of the router
Create the interface:ifconfig gif0 create
Set up the IPv4-endpoints of the tunnel:ifconfig gif0 tunnel $host-ipv4 $router-ipv4
Set up the IPv6-endpoints of the tunnel:ifconfig gif0 inet6 alias $tunnel-v6host $tunnel-v6router prefixlen 128
Set the (IPv6) default route on the tunnel:route add -inet6 default -interface gif0
LAB :
(D-Link router )
remote: WAN ipv4 211.1.1.120 ipv6 :2001:238:500::1/64 ,LAN ipv6:2001::1/64
local : WAN ipv4 211.1.1.100 ipv6 :2001:238:500::2/64 ,LAN ipv6 :2001:238:900::1/64
Create the interface:
#ifconfig gif0 create
Set up the IPv4-endpoints of the tunnel:
ifconfig gif0 tunnel 211.1.1.100 211.1.1.120
Set the (IPv6) default route on the tunnel:
route add -inet6 default -interface gif0
or route add -inet6 default 2001::/64 2001:238:500::1
test : from remote lan , ping6 2001:238:500::2 and 2001:238:900::1 successfully