* in diagrams, name routers as such
* enhance formatting * add section headers for examples
This commit is contained in:
parent
befea92737
commit
b007c29b93
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: gre.4,v 1.39 2008/05/10 09:33:31 martin Exp $
|
||||
.\" $NetBSD: gre.4,v 1.40 2009/01/04 16:27:48 hubertf Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd December 4, 2006
|
||||
.Dd January 4, 2009
|
||||
.Dt GRE 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -144,14 +144,16 @@ ones defined with
|
||||
for the interface (as if IP is encapsulated), but need not be, as e.g. when
|
||||
encapsulating AppleTalk.
|
||||
.Sh EXAMPLES
|
||||
.Ss Example 1: Basic GRE tunneling
|
||||
Configuration example:
|
||||
.Bd -literal
|
||||
Host X-- Host A ----------------tunnel---------- cisco D------Host E
|
||||
\\ |
|
||||
Host X-- Router A --------------tunnel---------- Router D ----Host E
|
||||
| |
|
||||
\\ /
|
||||
+------Host B----------Host C----------+
|
||||
+----- Router B ----- Router C --------+
|
||||
.Ed
|
||||
On host A
|
||||
.Pp
|
||||
On Router A
|
||||
.Pq Nx :
|
||||
.Bd -literal
|
||||
# route add default B
|
||||
@ -160,7 +162,8 @@ On host A
|
||||
# ifconfig greN tunnel A D
|
||||
# route add E D
|
||||
.Ed
|
||||
On Host D (Cisco):
|
||||
.Pp
|
||||
On Router D (Cisco):
|
||||
.Bd -literal
|
||||
Interface TunnelX
|
||||
ip unnumbered D ! e.g. address from Ethernet interface
|
||||
@ -170,8 +173,8 @@ On Host D (Cisco):
|
||||
ip route A mask C
|
||||
ip route X mask tunnelX
|
||||
.Ed
|
||||
OR
|
||||
On Host D
|
||||
.Pp
|
||||
or on Router D
|
||||
.Pq Nx :
|
||||
.Bd -literal
|
||||
# route add default C
|
||||
@ -182,16 +185,17 @@ On Host D
|
||||
.Pp
|
||||
If all goes well, you should see packets flowing ;-)
|
||||
.Pp
|
||||
If you want to reach Host A over the tunnel (from Host D (Cisco)), then
|
||||
you have to have an alias on Host A for e.g. the Ethernet interface like:
|
||||
If you want to reach Router A over the tunnel (from Router D (Cisco)), then
|
||||
you have to have an alias on Router A for e.g. the Ethernet interface like:
|
||||
.Bd -literal
|
||||
ifconfig \*[Lt]etherif\*[Gt] alias Y
|
||||
.Ed
|
||||
and on the cisco
|
||||
.Pp
|
||||
and on the Cisco
|
||||
.Bd -literal
|
||||
ip route Y mask tunnelX
|
||||
.Ed
|
||||
.Pp
|
||||
.Ss Example 2: Linking private subnets
|
||||
A similar setup can be used to create a link between two private networks
|
||||
(for example in the 192.168 subnet) over the Internet:
|
||||
.Bd -literal
|
||||
@ -200,11 +204,12 @@ A similar setup can be used to create a link between two private networks
|
||||
\\ /
|
||||
+----- the Internet ------+
|
||||
.Ed
|
||||
Assuming router A has the (external) IP address A and the internal address
|
||||
192.168.1.1, while router B has external address B and internal address
|
||||
.Pp
|
||||
Assuming Router A has the (external) IP address A and the internal address
|
||||
192.168.1.1, while Router B has external address B and internal address
|
||||
192.168.2.1, the following commands will configure the tunnel:
|
||||
.Pp
|
||||
On router A:
|
||||
On Router A:
|
||||
.Bd -literal
|
||||
# ifconfig greN create
|
||||
# ifconfig greN 192.168.1.1 192.168.2.1
|
||||
@ -212,7 +217,7 @@ On router A:
|
||||
# route add -net 192.168.2 -netmask 255.255.255.0 192.168.2.1
|
||||
.Ed
|
||||
.Pp
|
||||
On router B:
|
||||
On Router B:
|
||||
.Bd -literal
|
||||
# ifconfig greN create
|
||||
# ifconfig greN 192.168.2.1 192.168.1.1
|
||||
@ -220,6 +225,7 @@ On router B:
|
||||
# route add -net 192.168.1 -netmask 255.255.255.0 192.168.1.1
|
||||
.Ed
|
||||
.Pp
|
||||
.Ss Example 3: Encapsulating GRE in UDP
|
||||
To setup the same tunnel as above, but using GRE in UDP encapsulation
|
||||
instead of GRE encapsulation, set flags
|
||||
.Ar link0
|
||||
@ -227,7 +233,7 @@ and
|
||||
.Ar link2 ,
|
||||
and specify source and destination UDP ports.
|
||||
.Pp
|
||||
On router A:
|
||||
On Router A:
|
||||
.Bd -literal
|
||||
# ifconfig greN create
|
||||
# ifconfig greN link0 link2
|
||||
@ -236,38 +242,46 @@ On router A:
|
||||
# route add -net 192.168.2 -netmask 255.255.255.0 192.168.2.1
|
||||
.Ed
|
||||
.Pp
|
||||
On router B:
|
||||
On Router B:
|
||||
.Bd -literal
|
||||
# ifconfig greN create
|
||||
# ifconfig greN link0 link2
|
||||
# ifconfig greN 192.168.2.1 192.168.1.1
|
||||
# ifconfig greN tunnel B,port-B A,port-A
|
||||
# route add -net 192.168.1 -netmask 255.255.255.0 192.168.1.1
|
||||
.Ed
|
||||
.Pp
|
||||
.Ss Example 4: Realizing IPv6 connectivity
|
||||
Along these lines, you can use GRE tunnels to interconnect two IPv6
|
||||
networks over an IPv4 infrastructure, or to hook up to the IPv6 internet
|
||||
via an IPv4 tunnel to a Cisco router.
|
||||
.Bd -literal
|
||||
2001:db8:1::/64 -- NetBSD A -----tunnel----- Cisco B --- IPv6 Internet
|
||||
2001:db8:1::/64 -- NetBSD A ---- Tunnel ---- Cisco B --- IPv6 Internet
|
||||
\\ /
|
||||
\\ /
|
||||
+----- the Internet ------+
|
||||
|
||||
+------ the Internet ------+
|
||||
.Ed
|
||||
.Pp
|
||||
The example will use the following addressing:
|
||||
.Nx
|
||||
A has the IPv4 address A and the IPv6 address 2001:db8:1::1 (connects
|
||||
.Bl -hang
|
||||
.It Nx A
|
||||
has the IPv4 address A and the IPv6 address 2001:db8:1::1 (connects
|
||||
to internal network 2001:db8:1::/64).
|
||||
Cisco B has external IPv4 address B.
|
||||
All the IPv6 internet world is behind B, so A wants to route 0::0/0
|
||||
.It Cisco B
|
||||
has external IPv4 address B.
|
||||
.It All the IPv6 internet world
|
||||
is behind B, so A wants to route 0::0/0
|
||||
(the IPv6 default route) into the tunnel.
|
||||
The GRE tunnel will use a transit network: 2001:db8:ffff::1/64 on
|
||||
.It The GRE tunnel
|
||||
will use a transit network: 2001:db8:ffff::1/64 on
|
||||
the
|
||||
.Nx
|
||||
side, and ::2/64 on the Cisco side.
|
||||
.El
|
||||
.Pp
|
||||
Then the following commands will configure the tunnel:
|
||||
.Pp
|
||||
On router A
|
||||
On Router A
|
||||
.Pq Nx :
|
||||
.Bd -literal
|
||||
# ifconfig greN create
|
||||
@ -277,7 +291,7 @@ On router A
|
||||
# route add -inet6 0::0/0 2001:db8:ffff::2 -ifp greN
|
||||
.Ed
|
||||
.Pp
|
||||
On router B (Cisco):
|
||||
On Router B (Cisco):
|
||||
.Bd -literal
|
||||
Interface TunnelX
|
||||
tunnel mode gre ip
|
||||
|
Loading…
Reference in New Issue
Block a user