Sponsored Content
Full Discussion: IPSec VPN Routing
Special Forums IP Networking IPSec VPN Routing Post 302487381 by salukibob on Wednesday 12th of January 2011 09:06:52 AM
Old 01-12-2011
IPSec VPN Routing

Hello,

I'm trying to setup a gateway VPN between two routers across an unsecured network between two local networks. The routers are both linux and I'm using the ipsec tools, racoon and setkey. So far hosts from either local net can successfully ping hosts on the other local net without issue.

I'd like to also be able to ping from either of the routers to any host on the remote lan, including the remote router. This currently won't work.

My SPD policies on one of the routers is this:

Code:
spdadd 192.168.2.0/24[any] 192.168.1.0/24[any] any -P out ipsec esp/tunnel/194.16.1.6-194.16.1.7/require;
spdadd 192.168.1.0/24[any] 192.168.2.0/24[any] any -P in ipsec esp/tunnel/194.16.1.7-194.16.1.6/require;

Where my local networks are 192.168.2.0 an 192.168.1.0 with external IP's 194.16.1.6 and 194.16.1.7 respectively.

I've tried to add a route from the router to the remote network such are:
Code:
$ ip route add 192.168.2.0/24 dev eth0

but this doesn't work for me. I'm clearly missing something with the routing.

Any tips would be most appreciated.
Regards
Rob Smith
 

9 More Discussions You Might Find Interesting

1. Cybersecurity

IPSec - VPN using shared key

Hello! I have some trouble trying to configure a VPN with two gateways. One of them uses IPSec with a single key, 256bits length, specified in /etc/ipsec.secrets. As FreeSwan manual page says, if i put esp=3des-md5-96, will be used a "64bit IV key (internally generated), a 192bit 3des ekey and a... (3 Replies)
Discussion started by: eNTer
3 Replies

2. IP Networking

internal routing & vpn

hi there. i got a vpn working. this is what happens: remote pc ----(vpn/INTERNET)----vpn server--(redirect)---webapp (internal network) real: 200.12.15.20 200.20.45.123 vpn: 10.8.0.2 10.8.0.1 internal: ... (0 Replies)
Discussion started by: wachichornia
0 Replies

3. BSD

Problem on IPSec

Hi, this is my first post...:p Hello Admin :) Can I have an ask for something with my configuration ? I have finished some kind of the tutorial to build ipsec site to site, and the "step" has finished completely. I have a simulation with a local design topology with two PC's (FreeBSD ... (0 Replies)
Discussion started by: aulia
0 Replies

4. UNIX for Advanced & Expert Users

Ipsec implementation

How can i implement Ipsec between two machines in linux_ ubuntu? any link?? suggestion?? (0 Replies)
Discussion started by: elinaz
0 Replies

5. Cybersecurity

IPSEC

hello, after configuration ipsec in ip4 I can not ping between client and server whereas I had success ping before configuration! I also generate different key for AH and ESP as i have shown below. what is my problem and what should i do to have ping and test the configuration? code: ... (0 Replies)
Discussion started by: elinaz
0 Replies

6. IP Networking

VPN IPSec Openswan

Hi all, I have installed Openswan and configured IPSec and works perfect, but for some unknown reasons it stop working. I see that the tunnels are up and established. The route to the destination are added. Everything by the book seems to be ok. But somehow when i start to ping the other side (... (4 Replies)
Discussion started by: ivancd
4 Replies

7. IP Networking

Cisco 3750 Switch ASA VPN Routing

Hi,I want connect my ASA 5510 firewall to a 3750 switch with RIP routing. Unfortunately,I am having issues passing the VPN subnet through rip to the 3750.I don't understand how the routing table is populated on the ASA. Any suggestions? (0 Replies)
Discussion started by: Ayaerlee
0 Replies

8. IP Networking

IPSec Openswan Site to Site VPN - Big Pain

Hi @all, I try to connect 2 LANs with IPSec/Openswan LAN 1: 192.168.0.0/24 LAN 2: 192.168.1.0/24 This is my Config: conn HomeVPN # # Left security gateway, subnet behind it, nexthop toward right. left=192.168.1.29 ... (1 Reply)
Discussion started by: bahnhasser83
1 Replies

9. IP Networking

Best tool to monitor VPN IPSEC Tunneling

We are using cyberoam device, VPN IPSEC tunnel is going of frequently even the traffic is throug. Please suggest what may be the cause for the above mentioned issue. Also suggest a best tool to monitor the same VPN IPSEC tunnel connectivity. (4 Replies)
Discussion started by: marunmeera
4 Replies
GRE(4)							   BSD Kernel Interfaces Manual 						    GRE(4)

NAME
gre -- encapsulating network device SYNOPSIS
pseudo-device gre DESCRIPTION
The gre network interface pseudo device encapsulates datagrams into IP. These encapsulated datagrams are routed to a destination host, where they are decapsulated and further routed to their final destination. The ``tunnel'' appears to the inner datagrams as one hop. gre interfaces are dynamically created and destroyed with the ifconfig(8) create and destroy subcommands. This driver currently supports the following modes of operation: GRE encapsulation (IP protocol number 47) Encapsulated datagrams are prepended an outer datagram and a GRE header. The GRE header specifies the type of the encapsulated datagram and thus allows for tunneling other protocols than IP like e.g. AppleTalk. GRE mode is also the default tunnel mode on Cisco routers. This is also the default mode of operation of the greX interfaces. GRE in UDP encapsulation Encapsulated datagrams are prepended a GRE header, and then they are sent over a UDP socket. Userland may create the socket and ``delegate'' it to the kernel using the GRESSOCK ioctl(2). If userland does not supply a socket, then the kernel will create one using the addresses and ports supplied by ioctl(2)s SIOCSLIFPHYADDR, GRESADDRD, and/or GRESADDRS. MOBILE encapsulation (IP protocol number 55) Datagrams are encapsulated into IP, but with a shorter encapsulation. The original IP header is modified and the modifications are inserted between the so modified header and the original payload. Like gif(4), only for IP in IP encapsulation. The greX interfaces support a number of ioctl(2)s, such as: GRESADDRS: Set the IP address of the local tunnel end. This is the source address set by or displayed by ifconfig for the greX interface. GRESADDRD: Set the IP address of the remote tunnel end. This is the destination address set by or displayed by ifconfig for the greX interface. GREGADDRS: Query the IP address that is set for the local tunnel end. This is the address the encapsulation header carries as local address (i.e. the real address of the tunnel start point.) GREGADDRD: Query the IP address that is set for the remote tunnel end. This is the address the encapsulated packets are sent to (i.e. the real address of the remote tunnel endpoint.) GRESPROTO: Set the operation mode to the specified IP protocol value. The protocol is passed to the interface in (struct ifreq)->ifr_flags. The operation mode can also be given as link0 link2 IPPROTO_UDP link0 -link2 IPPROTO_GRE -link0 -link2 IPPROTO_MOBILE to ifconfig(8). GREGPROTO: Query operation mode. GRESSOCK: Delegate a socket from userland to a tunnel interface in UDP encapsulation mode. The file descriptor for the socket is passed in (struct ifreq)->ifr_value. Note that the IP addresses of the tunnel endpoints may be the same as the ones defined with ifconfig(8) for the interface (as if IP is encap- sulated), but need not be, as e.g. when encapsulating AppleTalk. EXAMPLES
Example 1: Basic GRE tunneling Configuration example: Host X-- Router A --------------tunnel---------- Router D ----Host E | | / +----- Router B ----- Router C --------+ On Router A (NetBSD): # route add default B # ifconfig greN create # ifconfig greN A D netmask 0xffffffff linkX up # ifconfig greN tunnel A D # route add E D On Router D (Cisco): Interface TunnelX ip unnumbered D ! e.g. address from Ethernet interface tunnel source D ! e.g. address from Ethernet interface tunnel destination A ip route C <some interface and mask> ip route A mask C ip route X mask tunnelX or on Router D (NetBSD): # route add default C # ifconfig greN create # ifconfig greN D A # ifconfig tunnel greN D A If all goes well, you should see packets flowing ;-) 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: ifconfig <etherif> alias Y and on the Cisco ip route Y mask tunnelX 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: 192.168.1.* --- Router A -------tunnel-------- Router B --- 192.168.2.* / / +----- the Internet ------+ 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: On Router A: # ifconfig greN create # ifconfig greN 192.168.1.1 192.168.2.1 # ifconfig greN tunnel A B # route add -net 192.168.2 -netmask 255.255.255.0 192.168.2.1 On Router B: # ifconfig greN create # ifconfig greN 192.168.2.1 192.168.1.1 # ifconfig greN tunnel B A # route add -net 192.168.1 -netmask 255.255.255.0 192.168.1.1 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 link0 and link2, and specify source and destination UDP ports. On Router A: # ifconfig greN create # ifconfig greN link0 link2 # ifconfig greN 192.168.1.1 192.168.2.1 # ifconfig greN tunnel A,port-A B,port-B # route add -net 192.168.2 -netmask 255.255.255.0 192.168.2.1 On Router B: # 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 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. 2001:db8:1::/64 -- NetBSD A ---- Tunnel ---- Cisco B --- IPv6 Internet / / +------ the Internet ------+ The example will use the following addressing: NetBSD 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 (the IPv6 default route) into the tunnel. The GRE tunnel will use a transit network: 2001:db8:ffff::1/64 on the NetBSD side, and ::2/64 on the Cisco side. Then the following commands will configure the tunnel: On Router A (NetBSD): # ifconfig greN create # ifconfig greN inet6 2001:db8:ffff::1/64 # ifconfig greN tunnel A B # route add -inet6 2001:db8:ffff::/64 2001:db8:ffff::2 -ifp greN # route add -inet6 0::0/0 2001:db8:ffff::2 -ifp greN On Router B (Cisco): Interface TunnelX tunnel mode gre ip ipv6 address 2001:db8:ffff::2/64 ! transfer network tunnel source B ! e.g. address from LAN interface tunnel destination A ! where the tunnel is connected to ipv6 route 2001:db8::/64 TunnelX ! route this network through tunnel NOTES
The MTU of greX interfaces is set to 1476 by default to match the value used by Cisco routers. This may not be an optimal value, depending on the link between the two tunnel endpoints. It can be adjusted via ifconfig(8). There needs to be a route to the decapsulating host that does not run over the tunnel, as this would be a loop. (This is not relevant for IPv6-over-IPv4 tunnels, of course.) In order to tell ifconfig(8) to actually mark the interface as up, the keyword ``up'' must be given last on its command line. The kernel must be set to forward datagrams by either option GATEWAY in the kernel config file or by issuing the appropriate option to sysctl(8). SEE ALSO
atalk(4), gif(4), inet(4), ip(4), netintro(4), options(4), protocols(5), ifconfig(8), sysctl(8) A description of GRE encapsulation can be found in RFC 1701 and RFC 1702. A description of MOBILE encapsulation can be found in RFC 2004. AUTHORS
Heiko W.Rupp <hwr@pilhuhn.de> David Young <dyoung@NetBSD.org> (GRE in UDP encapsulation, bug fixes) BUGS
The GRE RFCs are not yet fully implemented (no GRE options). The MOBILE encapsulation appears to have been broken since it was first added to NetBSD, until August 2006. It is known to interoperate with another gre in MOBILE mode, however, it has not been tested for interoperability with any other implementation of RFC 2004. The NetBSD base system does not (yet) contain a daemon for automatically establishing a UDP tunnel between a host behind a NAT router and a host on the Internet. BSD
January 4, 2009 BSD
All times are GMT -4. The time now is 11:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy