===== linux side * Server1: 10.0.0.1 / 255.255.255.252 * Server2: 10.0.0.2 / 255.255.255.252 ----- create ipip tunnel interface ip tunnel add tun0 mode ipip remote 200.200.200.200 local 100.100.100.100 dev eth0 ----- set interface IP addresses ifconfig tun0 10.0.0.1 netmask 255.255.255.252 pointopoint 10.0.0.2 ----- bring interface up ifconfig tun0 mtu 1500 up ----- show config ifconfig tun0 ----- create gif tunnel interface ifconfig gif0 create ----- set interface transport IP addresses gifconfig gif0 inet 200.200.200.200 100.100.100.100 ----- set interface IP addresses ifconfig gif0 10.0.0.2 netmask 255.255.255.252 10.0.0.3 ----- set interface MTU and bring interface up ifconfig gif0 mtu 1500 up ===== FreeBSD side ifconfig gif0 gif0: flags=8051 mtu 1500 tunnel inet 200.200.200.200 --> 100.100.100.100 inet 10.0.0.2 --> 10.0.0.1 netmask 0xfffffffc ping -c 4 10.0.0.2 use an MTU of 1,480 instead 1500 (overhead) ===== RC script # this should be the IP address of the remote server REMOTEIP=64.81.178.37 # this is the (routable) IP of the local server LOCALIP=216.254.21.186 # this is the private (10 net) IP of this end of the tunnel PRIVATELOCAL=10.13.13.13 # this is the private (10 net) IP of that end of the tunnel PRIVATEREMOTE=10.13.13.14 # add routes to these networks (separate by spaces) REMOTENET="$PRIVATEREMOTE/32 20.0.0.0/8 192.168.1.0/24" # this can be whatever; TUNDEV=gir # STOP EDITING HERE start() { iptunnel add ${TUNDEV} mode ipip remote ${REMOTEIP} local ${LOCALIP} ttl 255 ifconfig ${TUNDEV} ${PRIVATELOCAL} pointopoint ${PRIVATEREMOTE} # Note: check the above syntax; each linux seems to want a slightly different 'pointopoint' syntax. -EricJohanson for net in ${REMOTENET}; do route add -net $net dev ${TUNDEV} done } stop() { ifconfig ${TUNDEV} down iptunnel del ${TUNDEV} } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; esac =====