How can I configure a site-to-site VPN between a SonicWall and Linux Openswan?
This release includes significant user interface changes and many new features that are different from the SonicOS 6.2 and earlier firmware. The below resolution is for customers using SonicOS 6.5 firmware.
The Linux server
On this side (or branch office) is the Linux server as the router and providing Internet for the following network.
NOTE: The actual setup of a Linux machine to act as a network router is out of the scope of this document.
The SonicWall device
On this side (or branch office) is the SonicWall device serving as the router and providing Internet for the following network.
Openswan side configuration
NOTE: If you have not built your own kernel, chances are these are already built in.
Openswan config There are two configuration files you need to pay attention to:
NOTE: Having this option off caused issues.
nat_traversal=yes
oe=off
protostack=netkey
fragicmp=no
conn SonicWall
left=209.14.212.52
leftsourceip=192.168.0.1
leftsubnet=192.168.0.0/24
leftid=209.14.212.52
right=24.252.13.9
rightid=24.252.13.9
keyingtries=0
pfs=no
aggrmode=yes
auth=esp
esp=3des-sha1
ike=3des-sha1
authby=secret
keyexchange=ike
rightsubnet=10.0.0.0/24
NOTE: Thisallows the VPN to come up automatically when openswan starts.
auto=start
TIP: You'll notice the rightid and the leftid above. These are what helps identify the connexion when the Openswan and the SonicWall try to talk. Usually SonicWalls want this value set to a SonicWall Identifier. Well, if you haven't noticed by now your Openswan/Linux box won't have an identifier for itself. So we use the IP instead. SonicWalls will also accept that option.
NOTE: In the IPSec.secrets file make sure the IPs are correct. This will be what gives the authentication password for the VPN. If your IPs change and you have to change them in the IPSec.conf file, make sure to remember to change them here to. Otherwise you'll have errors and it won't establish a connexion.
iptables config
CAUTION: If you're doing masquerading and you have other Nat rules set up in iptables it will interfere with your VPN traffic. So, you will have to set rules to allow all traffic unaffected for your VPN subnet.
iptables -A INPUT -p ah -j ACCEPT
iptables -A INPUT -p esp -j ACCEPT
iptables -A INPUT -p udp -i eth0 --dport 500 -j ACCEPT
iptables -A INPUT -p udp -i eth0 --dport 4500 -j ACCEPT
iptables -A INPUT -p udp -i eth0 --dport 50:58 -j ACCEPT
iptables -A INPUT -p TCP -i eth0 --dport 50:58 -j ACCEPT
iptables -A INPUT -j ACCEPT --source 10.0.0.0/255.255.255.0
iptables -t Nat -A POSTROUTING -j ACCEPT --destination 10.0.0.0/255.255.255.0
iptables -t Nat -A PREROUTING -j ACCEPT --source 10.0.0.0/255.255.255.0
The point of the above commands is that they are placed before any other firewall rules take place that may interfere with traffic either bound to or coming from the SonicWall VPN network. In a default scenario without any restrictions we want to leave those packets untouched. If you find your VPN traffic is still being interfered with, check your other chains to see that they aren't mangling your VPN traffic.
If you need to insert the rule above another rule, for example above a MASQ rule, use the -I command instead.
EXAMPLE:
iptables -t Nat -I POSTROUTING 1 -j ACCEPT --destination 10.0.0.0/255.255.255.0
To put the rule first in the chain.
SonicWall side configuration The screenshots below are from the web interface for the SonicWall NSA .
NOTE:For the above you'll need to configure address objects for the Local Networks and Remote Networks. When configuring the Remote Networks address object make sure it's the same subnet as the Left (or Openswan/Linux) side. Otherwise you will get errors.
Proposals Tab
Advanced Tab
NOTE: The XAUTH option was checked in one of the articles I did see. However, this will make Openswan prompt you for another password and you won't be able to establish the VPN without it. Also, if you do not want SMB traffic to pass through the VPN Uncheck the NetBIOS flag.
Bringing up the VPN
/etc/init.d/IPSec restart
Debugging
Multiple subnets across the VPN
config setup
nat_traversal=yes
oe=off
protostack=netkey
fragicmp=no
conn SonicWall
left=209.14.212.52
leftsourceip=192.168.0.1
leftsubnet=192.168.0.0/24
leftid=209.14.212.52
right=24.252.13.9
rightid=24.252.13.9
keyingtries=0
pfs=no
aggrmode=yes
auth=esp
esp=3des-sha1
ike=3des-sha1
authby=secret
keyexchange=ike
conn SonicWall-0network
# Include the other config
also=SonicWall
# Our default subnet
rightsubnet=10.0.0.0/24
# Make sure this one autostarts
auto=start
conn SonicWall-1network
also=SonicWall
rightsubnet=10.0.1.0/24
auto=start
NOTE: Given that 10.0.1.0/24 is the other subnet behind the SonicWall on some VLAN or something. Make sure you put in the proper firewall rules to allow all traffic to and from the second subnet as well.
The below resolution is for customers using SonicOS 6.2 and earlier firmware. For firewalls that are generation 6 and newer we suggest to upgrade to the latest general release of SonicOS 6.5 firmware.
The Linux server
On this side (or branch office) is the Linux server as the router and providing Internet for the following network.
NOTE: The actual setup of a Linux machine to act as a network router is out of the scope of this document.
The SonicWall device
On this side (or branch office) is the SonicWall device serving as the router and providing Internet for the following network.
Openswan side configuration
NOTE: If you have not built your own kernel, chances are these are already built in.
Openswan config There are two configuration files you need to pay attention to:
NOTE: Having this option off caused issues.
nat_traversal=yes
oe=off
protostack=netkey
fragicmp=no
conn SonicWall
left=209.14.212.52
leftsourceip=192.168.0.1
leftsubnet=192.168.0.0/24
leftid=209.14.212.52
right=24.252.13.9
rightid=24.252.13.9
keyingtries=0
pfs=no
aggrmode=yes
auth=esp
esp=3des-sha1
ike=3des-sha1
authby=secret
keyexchange=ike
rightsubnet=10.0.0.0/24
auto=start
TIP: You'll notice the rightid and the leftid above. These are what helps identify the connexion when the Openswan and the SonicWall try to talk. Usually SonicWalls want this value set to a SonicWall Identifier. Well, if you haven't noticed by now your Openswan/Linux box won't have an identifier for itself. So we use the IP instead. SonicWalls will also accept that option.
NOTE: In the IPSec.secrets file make sure the IPs are correct. This will be what gives the authentication password for the VPN. If your IPs change and you have to change them in the IPSec.conf file, make sure to remember to change them here to. Otherwise you'll have errors and it won't establish a connexion.
iptables config
CAUTION: If you're doing masquerading and you have other Nat rules set up in iptables it will interfere with your VPN traffic. So, you will have to set rules to allow all traffic unaffected for your VPN subnet.
iptables -A INPUT -p ah -j ACCEPT
iptables -A INPUT -p esp -j ACCEPT
iptables -A INPUT -p udp -i eth0 --dport 500 -j ACCEPT
iptables -A INPUT -p udp -i eth0 --dport 4500 -j ACCEPT
iptables -A INPUT -p udp -i eth0 --dport 50:58 -j ACCEPT
iptables -A INPUT -p TCP -i eth0 --dport 50:58 -j ACCEPT
iptables -A INPUT -j ACCEPT --source 10.0.0.0/255.255.255.0
iptables -t Nat -A POSTROUTING -j ACCEPT --destination 10.0.0.0/255.255.255.0
iptables -t Nat -A PREROUTING -j ACCEPT --source 10.0.0.0/255.255.255.0
The point of the above commands is that they are placed before any other firewall rules take place that may interfere with traffic either bound to or coming from the SonicWall VPN network. In a default scenario without any restrictions we want to leave those packets untouched. If you find your VPN traffic is still being interfered with, check your other chains to see that they aren't mangling your VPN traffic.
If you need to insert the rule above another rule, for example above a MASQ rule, use the -I command instead.
EXAMPLE:
iptables -t Nat -I POSTROUTING 1 -j ACCEPT --destination 10.0.0.0/255.255.255.0
To put the rule first in the chain.
SonicWall side configuration The screenshots below are from the web interface for the SonicWall NSA 2400.
Bringing up the VPN
/etc/init.d/IPSec restart
Debugging
Multiple subnets across the VPN
config setup
nat_traversal=yes
oe=off
protostack=netkey
fragicmp=no
conn SonicWall
left=209.14.212.52
leftsourceip=192.168.0.1
leftsubnet=192.168.0.0/24
leftid=209.14.212.52
right=24.252.13.9
rightid=24.252.13.9
keyingtries=0
pfs=no
aggrmode=yes
auth=esp
esp=3des-sha1
ike=3des-sha1
authby=secret
keyexchange=ike
conn SonicWall-0network
# Include the other config
also=SonicWall
# Our default subnet
rightsubnet=10.0.0.0/24
# Make sure this one autostarts
auto=start
conn SonicWall-1network
also=SonicWall
rightsubnet=10.0.1.0/24
auto=start
NOTE: Given that 10.0.1.0/24 is the other subnet behind the SonicWall on some VLAN or something. Make sure you put in the proper firewall rules to allow all traffic to and from the second subnet as well.