Question: Is it possible to create an VPN connection while using site-to-site VPN?

Have you ever tried or done this?

What are possible problems, pitfalls, things of the impossible, etc. ?

Also see: [Is it possible to use Microsoft's "Secure Connection Rules" (IPSec) with VPN?](https://serverfault.com/questions/126537/is-it-possible-to-use-microsofts-secure-connection-rules-ipsec-with-vpn)

Answer: 
Here's a complete solution. Keep a list of your servers ip addresses and/or domains and the colors you want for them in in ~/.server\_colors:

```

192.168.122.102,Red Sands
192.168.122.103,Ocean
www.foo.com,Grass
foo.com,Grass

```

Then add this line to ~/.profile to hijack the ssh command:

```
alias ssh="~/bin/safe_ssh $1"
```

Then compare whatever's after the @ in your ssh target to your list. If there's a match, run an AppleScript to change the screen to the corresponding color. Here's ~/bin/safe\_ssh:

```

#!/bin/bash
ip=`echo $1 | cut -d"@" -f2`
match=`cat ~/.server_colors | grep $ip | wc -l`
if [ $match -gt 0 ]
then
    color=`cat ~/.server_colors | grep $ip | cut -f2 -d","`
    osascript ~/bin/change_terminal_color.scpt "$color" 2>/dev/null
fi
/usr/bin/ssh $1

```

And last, here's ~/bin/change\_terminal\_color.scpt

```

on run argv
    tell application "Terminal" to set current settings of selected tab of window 1 to (first settings set whose name is (item 1 of argv))
end run

```

I took most of this code from [this blog post](http://www.sipfish.com/blog/automatically-change-command-line-colors-when-using-ssh/).
I use a script that launches SSH in xterm windows with different bg/fg colors. It selects the colors based on the hostname's hash from a color span so that no configuration is needed. 

The script is written in Ruby: <https://github.com/mickeyil/ssx>