Deleted Added
full compact
udp.tunnel (56706) udp.tunnel (120612)
1#!/bin/sh
1#!/bin/sh
2# $FreeBSD: head/share/examples/netgraph/udp.tunnel 56706 2000-01-28 00:44:30Z archie $
2# $FreeBSD: head/share/examples/netgraph/udp.tunnel 120612 2003-09-30 22:39:22Z julian $
3
4# This script sets up a virtual point-to-point WAN link between
5# two subnets, using UDP packets as the ``WAN connection.''
6# The two subnets might be non-routable addresses behind a
7# firewall.
8#
9
10# Here define the local and remote inside networks as well

--- 15 unchanged lines hidden (view full) ---

26if ifconfig ng0 >/dev/null 2>&1; then
27 ifconfig ng0 inet down delete >/dev/null 2>&1
28 ngctl shutdown ng0:
29else
30 ngctl mkpeer iface dummy inet
31fi
32
33# Attach a UDP socket to the ``inet'' hook of the interface node
3
4# This script sets up a virtual point-to-point WAN link between
5# two subnets, using UDP packets as the ``WAN connection.''
6# The two subnets might be non-routable addresses behind a
7# firewall.
8#
9
10# Here define the local and remote inside networks as well

--- 15 unchanged lines hidden (view full) ---

26if ifconfig ng0 >/dev/null 2>&1; then
27 ifconfig ng0 inet down delete >/dev/null 2>&1
28 ngctl shutdown ng0:
29else
30 ngctl mkpeer iface dummy inet
31fi
32
33# Attach a UDP socket to the ``inet'' hook of the interface node
34# using the ng_ksocket(8) node type.
34# using the ng_ksocket(4) node type.
35#
36ngctl mkpeer ng0: ksocket inet inet/dgram/udp
37
38# Bind the UDP socket to the local external IP address and port
39#
40ngctl msg ng0:inet bind inet/${LOC_EXTERIOR_IP}:${UDP_TUNNEL_PORT}
41
42# Connect the UDP socket to the peer's external IP address and port
43#
44ngctl msg ng0:inet connect inet/${REM_EXTERIOR_IP}:${UDP_TUNNEL_PORT}
45
46# Configure the point-to-point interface
47#
48ifconfig ng0 ${LOC_INTERIOR_IP} ${REM_INTERIOR_IP}
49
50# Add a route to the peer's interior network via the tunnel
51#
52route add ${REM_INSIDE_NET} ${REM_INTERIOR_IP}
53
35#
36ngctl mkpeer ng0: ksocket inet inet/dgram/udp
37
38# Bind the UDP socket to the local external IP address and port
39#
40ngctl msg ng0:inet bind inet/${LOC_EXTERIOR_IP}:${UDP_TUNNEL_PORT}
41
42# Connect the UDP socket to the peer's external IP address and port
43#
44ngctl msg ng0:inet connect inet/${REM_EXTERIOR_IP}:${UDP_TUNNEL_PORT}
45
46# Configure the point-to-point interface
47#
48ifconfig ng0 ${LOC_INTERIOR_IP} ${REM_INTERIOR_IP}
49
50# Add a route to the peer's interior network via the tunnel
51#
52route add ${REM_INSIDE_NET} ${REM_INTERIOR_IP}
53