GNS3 Cisco Network Scheme Security

Tags:
#cisco , #router, #switch, #Network , #vpn , #gns3, #dynamips, #vios, #ios, #virtual-machine , #virtualization , #CCNA


Navigation

Synopsis
...

This writeup is essentially a trial an error documentation of my learning process for configuration a site-to-site VPN and site-to-site VPN with firewall using CISCO IOS images in GNS3 with a mock network setup.

References
...

GNS3 Marketplace (lists of supported images and instructions)
...

  • Cisco-Asa - firewall images
  • Cisco-ASAV - virtual firewall emulators
  • Cisco-IOSV - virtual router QEMU emulators
  • Cisco-IOSV-L2 - virtual Layer 2 switch QEMU emulators
  • Cisco-IOU-L2 - virtual layer 2 switches on linux, not QEMU
  • Cisco-IOU-L3 - virtual layer 3 on linux, not QEMU (proprietary cisco employee type)
  • Cisco 7200 - support C7200 series routers - c7200-adventerprisek9-mz.124-24.T5.image

Commands
...

That ended up being used very frequently
...

  • linux custom bins
gns3-cnoss
gns3server
gns3server --local
gns3-cnoss-taphost
  • Cisco Router
show running-config
show ip interface brief 
show access-lists
show ip route
config-register 0x2102
show crypto map <mapname>
  • Cisco ASA
<command name> ? --> get more info about any command's options
enable
configure terminal
terminal pager 0
show interface summary
show interface ip brief
show run crypto map
show run crypto isakmp sa
show crypto ipsec sa
sh access-list
  • linux troubleshooting
ip route # the one called "default" should be gateway
route -nv
ifconfig
sysctl net.ipv4.ip_forward #should be set to 1
arp -a
sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 192.168.1.5
sudo ip route add 10.10.0.0/16 via 10.10.40.0 dev ens4

# I deleted this route for KVM because it appeared to be doing nothing
sudo ip route del 169.254.0.0/16 via 0.0.0.0 dev virbr0

---------------------- Tasks ----------------------
...

Install GNS3
...

Linux KVM Installation
...

  • this method is most valuable if someone wished to isolate GNS3 resources or deploy on an off-host machine, but it's not necessary on linux in order to get the KVM support for Cisco images

  • it's not super obvious, but GNS3 does have a premade KVM VM that can be acquired from their github release page
    cnossprac1netsec-2023-02-22.png

  • their KVM image comes with a startup script that looks like:

#!/bin/bash

if [[ ! $(ip link show virbr0) ]]
then
  sudo apt update
  sudo apt install -y libvirt-bin
fi

if [[ ! $(ip link show tap-gns3vm) ]]
then
  echo "Creating TAP interface"
  sudo ip tuntap add dev tap-gns3vm mode tap user $(whoami)
  sudo ip link set tap-gns3vm up
  sudo brctl addif virbr0 tap-gns3vm
fi

qemu-system-x86_64 -name "GNS3 VM" -m 2048M -cpu host -enable-kvm -machine smm=off -boot order=c \
-drive file="GNS3 VM-disk001.qcow2",if=virtio,index=0,media=disk \
-drive file="GNS3 VM-disk002.qcow2",if=virtio,index=1,media=disk \
-device virtio-net-pci,netdev=nic0 -netdev tap,id=nic0,ifname=tap-gns3vm,script=no,downscript=no
  • I dropped this monster command into a local binary called gns3 so that I can run it with an alias
  • and redirected the launch to the absolute path of the images
  • placed in ~/.local/bin/gns-cnoss
#!/bin/bash

echo "Creating TAP interface"
sudo ip tuntap add dev tap-gns3vm mode tap user $(whoami)
sudo ip link set tap-gns3vm up
sudo brctl addif virbr0 tap-gns3vm

echo "Starting gns3 vm..."
sudo qemu-system-x86_64 -name "GNS3 VM" -m 2048M -cpu host -enable-kvm -machine smm=off -boot order=c \
-drive file="/var/lib/libvirt/images/gns3-cnoss/GNS3 VM-disk001.qcow2",if=virtio,index=0,media=disk \
-drive file="/var/lib/libvirt/images/gns3-cnoss/GNS3 VM-disk002.qcow2",if=virtio,index=1,media=disk \
-device virtio-net-pci,netdev=nic0 -netdev tap,id=nic0,ifname=tap-gns3vm,script=no,downscript=no
Note

I noticed later that for whatever reason this script is just too fast for the interfaces to setup before the VM starts up, so I added a sleep to give it a moment, which seems to have fixed the issue 🤷

[....]
sudo brctl addif virbr0 tap-gns3vm
sleep 3s
echo "Starting gns3 vm..."
[....]
  • I've already got KVM installed and libvirt, so I'm just going to manually perform the tap interface creation and run the bottom part when I want to load their qcows
#add a new bridge device called tap-gns3vm
sudo ip tuntap add dev tap-gns3vm mode tap user $(whoami)
#enable the new interface
sudo ip link set tap-gns3vm up
#attach the new interface to the virbr0 virtual bridge
sudo brctl addif virbr0 tap-gns3vm
  • brctl show virbr0 yields
bridge name	bridge id		STP enabled	interfaces
virbr0		8000.525400ca8e4c	yes		tap-gns3vm

cnossprac1netsec-2023-02-22-5.png

ping 192.168.122.76
PING 192.168.122.76 (192.168.122.76) 56(84) bytes of data.
64 bytes from 192.168.122.76: icmp_seq=1 ttl=64 time=0.122 ms
64 bytes from 192.168.122.76: icmp_seq=2 ttl=64 time=0.187 ms
64 bytes from 192.168.122.76: icmp_seq=3 ttl=64 time=0.171 ms
^C
--- 192.168.122.76 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2029ms
rtt min/avg/max/mdev = 0.122/0.160/0.187/0.027 ms

visiting the VM in the browser yields

cnossprac1netsec-2023-02-22-6.png

  • quick little test in the VM shell to see if I can access the internet

cnossprac1netsec-2023-02-22-7.png

  • quick little test in the VM shell to see if my bridge interface is working, because I should be able to view local area network devices
    cnossprac1netsec-2023-02-22-8.png

  • router response
    cnossprac1netsec-2023-02-22-9.png

  • final personal test was seeing if I could ping and ssh to my local server, yeah looks good, bridge is working correctly
    cnossprac1netsec-2023-02-22-10.png

Windows Installation
...

  • Downloading the GNS3 VM | GNS3 Documentation

  • just as with linux KVM, windows VM also runs GNS3 (and it is required for KVM support on windows)

  • can be imported into virtualbox or vmware and if interfaces with host pc are desired they can be NAT'd through virtual interfaces on windows
    cnossprac1netsec-2023-03-20.png

Install GNS3 Client
...

Realize that the web GUI is pretty awful if you want to follow any guides written online anywhere including GNS3's own documentation 🤷
sudo add-apt-repository ppa:gns3/ppa
sudo apt update                                
sudo apt install gns3-gui gns3-server

# Not needed, probably going to break something with this
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gns3-iou

cnossprac1netsec-2023-02-22-24.png

cnossprac1netsec-2023-02-22-25.png

  • run gns3server, only if you want to test local virtual networks, but without good hardware virtualization support

    • which turns out to only matter on windows in the end
  • need to add "remote" server in order to connect to VM
    cnossprac1netsec-2023-02-22-27.png

  • note that the desktop GUI actually gives a real human error when something isn't correct (the web gui obfuscates a lot of these messages)
    cnossprac1netsec-2023-02-22-28.png

Install GNS3 Server on Linux Natively
...

  • add myself to the groups required to launch GNS3 things so that I don't have to be sudo every time

sudo apt install gns3-server
# wireshark docker 
sudo usermod -aG ubridge yorionathan
sudo usermod -aG libvirt yorionathan
sudo usermod -aG kvm yorionathan
  • running this is as simple as
gns3server
  • occasionally there are issues where it can't correct bind to the local network interface, assumed that this is related to other things running, solved with a reboot usually

Import Virtual Firmware Images
...

See if the lab hardware images can be simulated in GNS3
...

cnossprac1netsec-2023-02-22-11.png

cnossprac1netsec-2023-02-22-12.png

cnossprac1netsec-2023-02-22-13.png

  • something I personally found potentially confusing
    cnossprac1netsec-2023-02-22-14.png

cnossprac1netsec-2023-02-22-15.png

cnossprac1netsec-2023-02-22-16.png

  • datasheet says default onboard memory for these is 512 MB
    cnossprac1netsec-2023-02-22-17.png

  • so that's what was set
    cnossprac1netsec-2023-02-22-18.png

Ah wait a minute....
...

cnossprac1netsec-2023-02-22-16.png

  • the gns3 documentation says...

  • okay so none of these bins are in their recommended categories...
    cnossprac1netsec-2023-02-22-19.png

  • and they don't support catalyst switches at all
    cnossprac1netsec-2023-02-22-20.png

  • annnnd of course the C2960 is a catalyst switch
    cnossprac1netsec-2023-02-22-21.png

  • annnnd the ASA 5505 is a supported version... but they recommend not to use these as the consume all of CPU
    cnossprac1netsec-2023-02-22-22.png

cnossprac1netsec-2023-02-22-23.png

Find some alternatives to lab images
...

Need:
...

Router - probably the 7200 - or a virtual router VIOS
...

Firewall - ASA 5504 will work, perhaps pfsense or something else - or ASAv
...

Switch - IOU L2 Binary or IOSvL2
...

cnossprac1netsec-2023-02-22-29.png

cnossprac1netsec-2023-02-22-30.png

Import images into GNS3 desktop GUI
...

cnossprac1netsec-2023-02-24.png

cnossprac1netsec-2023-02-24-1.png

  • pick device
    cnossprac1netsec-2023-02-24-2.png

cnossprac1netsec-2023-02-24-3.png

  • make sure whatever binaries that are needed for the device are present

C7200 Router
...

cnossprac1netsec-2023-02-24-4.png

cnossprac1netsec-2023-02-24-5.png

IOU L2 Linux Virtual Switch
...

Dump base IOS config
...

enable
! put the password in if there is one
terminal length 0
! which will dump out the whole terminal and not screen by screen

show running-config
  • show running-config dumps the router's entire current config to terminal
  • but only if terminal length 0 is enabled, for single screen
Building configuration...

Current configuration : 1023 bytes
!
upgrade fpd auto
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1-Cisco7200
!
boot-start-marker
boot-end-marker
!
logging message-counter syslog
!
no aaa new-model
ip source-route
no ip icmp rate-limit unreachable
ip cef
!
no ip domain lookup
no ipv6 cef
!
multilink bundle-name authenticated
!
archive
 log config
  hidekeys
! 
ip tcp synwait-time 5
!
interface Ethernet0/0
 no ip address
 shutdown
 duplex auto
!
interface GigabitEthernet0/0
 no ip address
 shutdown
 duplex full
 speed 1000
 media-type gbic
 negotiation auto
!
ip forward-protocol nd
no ip http server
no ip http secure-server
!
no cdp log mismatch duplex
!
control-plane
!
gatekeeper
 shutdown
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line vty 0 4
 login
!
end
  • there are default base startup configs which are stored locally
    cnossprac1netsec-2023-02-24-7.png

  • if one were to look at this, the config the router prints is being sourced from here

!
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname %h
!
ip cef
no ip domain-lookup
no ip icmp rate-limit unreachable
ip tcp synwait 5
no cdp log mismatch duplex
!
line con 0
 exec-timeout 0 0
 logging synchronous
 privilege level 15
 no login
line aux 0
 exec-timeout 0 0
 logging synchronous
 privilege level 15
 no login
!
!
end
  • but something to note is that those configs are actually present in the GNS3 VM home directory as well
  • so if the GNS3 client is connect to the VM, it's probably pulling the local path of these base configs by default and not anything in the client
    cnossprac1netsec-2023-02-24-8.png

Simple router config and project backup test
...

configure terminal
interface GigabitEthernet 0/0
ip address 10.10.10.1 255.255.255.0
no shut

*Feb 24 12:24:01.315: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Feb 24 12:24:02.315: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up

exit
! (config-if)
exit
! (config)

write memory

! Should see
! Building configuration...
! [OK]



show ip interface brief


R1-Cisco7200#show ip interface brief 
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                unassigned      YES unset  administratively down down    
GigabitEthernet0/0         10.10.10.1      YES manual up                    up      

  • assign PC IP and gateway
PC1> ip 10.10.10.2/24 10.10.10.1


PC1> ping 10.10.10.1

84 bytes from 10.10.10.1 icmp_seq=1 ttl=255 time=20.110 ms
84 bytes from 10.10.10.1 icmp_seq=2 ttl=255 time=2.098 ms
84 bytes from 10.10.10.1 icmp_seq=3 ttl=255 time=3.199 ms
84 bytes from 10.10.10.1 icmp_seq=4 ttl=255 time=2.336 ms
84 bytes from 10.10.10.1 icmp_seq=5 ttl=255 time=2.534 ms

Importing a Virtual Operating System as PC into GNS3
...

Linux Native (See KVM for actual import, same as Native)
...

  • add in a NAT cloud, which gns3-server automatically uses to create a TAP interface with the host
    cnossprac1netsec-2023-03-10.png

cnossprac1netsec-2023-03-10-1.png

  • from the NAT direct connection to the lubuntu system I can do updates, install net tools, whatever to make troubleshooting a bit easier

cnossprac1netsec-2023-03-10-2.png

  • just some simple setup things
    cnossprac1netsec-2023-03-10-3.png

KVM
...

cnossprac1netsec-2023-03-08.png

cnossprac1netsec-2023-03-08-1.png

  • QEMU/KVM hypervisor, 4 gigs ram
    cnossprac1netsec-2023-03-08-2.png

cnossprac1netsec-2023-03-08-3.png

  • upload image into GNS3

cnossprac1netsec-2023-03-08-4.png

  • went back into template and changed virtio for disk type

cnossprac1netsec-2023-03-08-5.png

  • boots up a Lubuntu machine
    cnossprac1netsec-2023-03-08-6.png

Notes on Some Default Router Setup Points
...

  • Images for devices in GNS3 won't necessarily have all slots enabled by default, so whichever ones are desired are needed to be enabled in order to connect the virtual cabling
  • Cisco provides some handy configuration guides

Visual comparison of lab configs vs default GNS3 IOS configs
...

  • need to quickly compare differences between lab setup and these virtual switches and see which parts are absolutely essential
    • use my handy little dump tool for the IOSvL2 switch
./dump_config_nopass.expect 192.168.122.76 5003 switch_dump.txt
interface Vlan1
 ip address 10.0.0.10 255.255.255.0
!
ip default-gateway 10.0.0.1
ip http server
ip http authentication local
ip http secure-server

Configure Some Default Router Setup
...

enable
config

username admin privilege 15 password 0 admin
ip http server
ip http authentication local
ip http secure-server
ip route 0.0.0.0 0.0.0.0 10.0.0.254

interface GigabitEthernet0/0
 ip address 10.0.0.2 255.255.255.0
 duplex auto
 speed auto
 media-type rj45
!         
interface GigabitEthernet0/1
 ip address 10.0.1.1 255.255.255.0
 duplex auto
 speed auto
 media-type rj45
!  

Importing or Dumping Cisco Configurations with Scripts
...

TCL and Expect Scripts
...

  • in order to import a whole config into a router over telnet (at least on linux) one can take advantage of the expect syntax and TCL scripting
Note

In this TCL language
">" and "#" are expressions for user and authorized modes respectively
and are syntactically required to get the script to interpret commands with different privileges

  • expect might not be installed by default so:
sudo apt install expect
  • using expect, instead of bash, one can push scripted commands over telnet to things like Cisco routers etc
  • script that will push a config specified in a text file into the virtual interface over telnet
#!/usr/bin/expect -f

# push_config.sh

# Get the variables from command line arguments to script
set router_ip [lindex $argv 0]
set router_user [lindex $argv 1]
set router_pass [lindex $argv 2]

# Open the Telnet connection and authenticate
spawn telnet $router_ip
expect "Username: "
send "$router_user\r"
expect "Password: "
send "$router_pass\r"
expect ">"

# enter enable mode to configure, authenticate, begin config 
send "enable\r"
expect "Password: "
send "$router_pass\r"
expect "#"
send "configure terminal\r"
expect "(config)#"

######### Push the configuration #######
set config [exec cat config.txt]
send "$config\r"
expect "(config)#"
########################################

# Exit configuration mode
send "exit\r"
expect "#"

# Save the configuration
send "write memory\r"
expect "#"

# Close the Telnet connection
send "exit\r"
expect eof

  • executable
chmod +x push_config.sh
  • the configuration can be whatever is needed for that particular device

  • example to send the script with command line arguments

  • I need to specify ip and port for telnet, and since this is bridged I can access telnet directly over local IP without tunneling into the GNS3 subnet from the host

  • this script can be used in reverse to dump configs from routers to local text files

#!/usr/bin/expect -f

# dump_config.expect

# Get the variables from command line arguments to script
set router_ip [lindex $argv 0]
set router_port [lindex $argv 1]
# set router_user [lindex $argv 2]
# set router_pass [lindex $argv 3]
set output_config_file  [lindex $argv 2]

# Open the Telnet connection
spawn telnet $router_ip $router_port

### Authenticate if necessary
# expect "Username: "
# send "$router_user\r"
# expect "Password: "
# send "$router_pass\r"
# expect ">"

# Enter enable mode
expect "#"
send "enable\r"

# Authenticate?
# expect "Password: "
# send "$router_pass\r"

####### Dump the running configuration to a file ######
expect "#"
send "terminal length 0\r"
expect "#"
send "show running-config\r"
expect "#"
# dump whatever is in buffer
#set config [string trimright $output_config_file(buffer) "#"]
set config $expect_out(buffer)
# open up the file
set active_file [open $output_config_file "w"]
# put (in empty file) contents of config
puts $active_file $config
# close the file
close $active_file
#######################################################

# Close the Telnet connection
send "exit\r"
expect eof
./dump_config.sh <router_ip> <router_port> <router_user> <router_pass> <output_file>
  • if a username and password would be required
./dump_config.expect 192.168.122.76 5002 "" "" config_dump.txt
  • if not username and password required
./dump_config_nopass.expect 192.168.122.76 5002 config_dump.txt
  • I had some issues with that not waiting for the buffer output to fully complete and giving me a partial config dumped to text file, so I altered it to have a timeout expect function to wait for the buffer to actually dump something useful before writing it to an output file
expect {
    "#$"
    {set output $expect_out(buffer)}
    timeout
    {send_user "Error: Timeout waiting for command output\n"; exit 1}
}
  • new script
#!/usr/bin/expect -f

# dump_config.expect

# Get the variables from command line arguments to script
set router_ip [lindex $argv 0]
set router_port [lindex $argv 1]
# set router_user [lindex $argv 2]
# set router_pass [lindex $argv 3]
set output_config_file  [lindex $argv 2]

# Open the Telnet connection and authenticate
spawn telnet $router_ip $router_port
# expect "Username: "
# send "$router_user\r"
# expect "Password: "
# send "$router_pass\r"
# expect ">"

# Enter enable mode and authenticate
expect "#"
send "enable\r"
# expect "Password: "
# send "$router_pass\r"
expect "#"

#################### Dump the running configuration to a file ###################
send "terminal length 0\r"
expect "#"
send "show running-config\r"
expect "#"
##### dump whatever is in buffer but actually wait to make sure it completes ####
expect {
    "#$"
    {set config $expect_out(buffer)}
    timeout
    {send_user "Error: Timeout waiting for command output\n"; exit 1}
}
##################################################################################
# set a variable for opening up the file
set active_file [open $output_config_file "w"]
# put (in empty file) contents of config dumped from buffer
puts $active_file $config
# close the file
close $active_file
#######################################################

# Close the Telnet connection
send "exit\r"
expect eof

Talking to the Outside World from GNS3
...

Linux Native
...

How one would setup an interface for the GNS3 network to talk with the host computer
...

  • create a script that will make a tap adapter for me and assign an IP address to it that can serve as my mock network
  • I'm also having it let the host computer know that a static route to the 10.10.10.0/24 subnet is available via the new tap on 192.168.1.5
#!/bin/bash

echo "Creating TAP interface for host"
sudo ip tuntap add dev tap-gns3host mode tap user $(whoami)
sudo ip addr add 192.168.1.5/24 dev tap-gns3host
sudo ip link set tap-gns3host up

echo "Adding a route to the GNS3 internal subnet"
echo "Subnet is 10.10.10.0/24, change in script for others"
sudo route add -net 10.10.10.0 netmask 255.255.255.0 gw 192.168.1.5

echo "Starting GNS3 Server...."
sleep 5s
gns3server
  • using a configuration like this it was possible to just bridge NAT with the lubuntu VM and install some small things like net-tools for troubleshooting, not really a big deal for the actual GNS3 topology though

cnossprac1netsec-2023-03-10-4.png

cnossprac1netsec-2023-03-10-5.png

  • configure the router to understand that it is now part of the host network on one interface
  • setup translation in the router to handle NAT between the internal network and whatever the network is on the outside of GNS3
  • gateway will change depending on how traffic should be routed to connected PC
enable
config

hostname GNS3-Router1

! the local gns3 network on 10.10.10.X
interface GigabitEthernet 0/0
ip address 10.10.10.1 255.255.255.0
no shut
exit

! the host network on 192.168.1.X
interface GigabitEthernet0/1
ip address 192.168.1.6 255.255.255.0
no shut
exit
!  

! route to the 192.168.1.X network via 192.168.1.6 gateway
! this basically says, the path to the whole 192.168.1.X network is VIA
! the gateway on 192.168.1.1 if this is my home router, but could be
! bakhtawar's laptop's IP in our connected scenario
ip route 0.0.0.0 0.0.0.0 192.168.1.1

! the route to the 192.168.1.0/24 subnet is on GigabitEthernet0/1
ip route 192.168.1.0 255.255.255.0 GigabitEthernet0/1

! setting the translation such that this is our external network
interface GigabitEthernet0/1
 ip nat inside

! setting the translation such that this is our internal network
interface GigabitEthernet0/0
 ip nat outside

! access list to allow traffic from 10.10.10.0/24 to be handled by NAT
access-list 101 permit 10.10.10.0 0.0.0.255

! tells our NAT to translate anything from the 10.10.10.0/24 subnet
! to everything on the 192.168.1.0/24 subnet
ip nat inside source list 1 interface GigabitEthernet0/0 overload

write memory
  • router dump @ 9:23:16
Building configuration...

Current configuration : 3430 bytes
!
! Last configuration change at 19:11:12 UTC Fri Mar 10 2023
!
version 15.6
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Router
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ethernet lmi ce
!
!
!
mmi polling-interval 60
no mmi auto-configure
no mmi pvc
mmi snmp-timeout 180
!
!
no ip icmp rate-limit unreachable
!
!
no ip domain lookup
ip cef
no ipv6 cef
!
multilink bundle-name authenticated
!
!
redundancy
!
no cdp log mismatch duplex
!
ip tcp synwait-time 5
! 
!
!
interface GigabitEthernet0/0
 ip address 10.10.10.1 255.255.255.0
 no ip proxy-arp
 ip nat outside
 ip virtual-reassembly in
 duplex auto
 speed auto
 media-type rj45
!
interface GigabitEthernet0/1
 ip address 192.168.1.6 255.255.255.0
 no ip proxy-arp
 ip nat inside
 ip virtual-reassembly in
 duplex auto
 speed auto
 media-type rj45
!
interface GigabitEthernet0/2
 no ip address
 shutdown
 duplex auto
 speed auto
 media-type rj45
!
interface GigabitEthernet0/3
 no ip address
 shutdown
 duplex auto
 speed auto
 media-type rj45
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
ip nat inside source static 10.10.10.0 192.168.1.6
ip route 0.0.0.0 0.0.0.0 192.168.1.1
ip route 192.168.1.0 255.255.255.0 GigabitEthernet0/1
!
!
!
!
control-plane
!
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
line vty 0 4
 login
 transport input none
!
no scheduler allocate
!
end

Router#clear arp-cache
Router#ping 192.168.1.76
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.76, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
Router#ping 192.168.1.1 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
Router#wr
Building configuration...

cnossprac1netsec-2023-03-10-6.png

KVM
...

(I stopped trying this route after I realized how silly it is to create these nested networks on a linux host) But I'm leaving it in here because I feel like I suffered enough with it for it to have a place in the report and I at least learned some things about creating adapters in linux and such

Creating a TAP interface on Linux to talk from Host to GNS3 network
...

sudo apt install bridge-utils

# creating a TAP interface
#sudo tunctl -u <username>
#sudo tunctl -t tap0
sudo ip tuntap add dev tap-gns3-cloud mode tap user $(whoami) # I assume this would also work

sudo ifconfig tap-gns3-cloud 0.0.0.0 promisc up
sudo ifconfig eth0 0.0.0.0 promisc up

sudo brctl addbr br0-gns3-cloud # should only need to do that once?
sudo brctl addif br0-gns3-cloud tap-gns3-cloud
sudo brctl addif br0-gns3-cloud eth0

sudo ifconfig br0-gns3-cloud up
sudo ifconfig br0-gns3-cloud 192.168.1.5/24

# sudo route add default gw 10.10.10.254

sudo brctl show
  • add this reiterating part to an additional script GNS3 to recreate the interface setup after a reboot
  • gns3-cnoss-taphost
echo "Adding Host Bridge and TAP to GNS3"
sudo ip tuntap add dev tap-gns3vm-cloud mode tap user $(whoami) # I assume this would also work

sudo ifconfig tap-gns3vm-cloud 0.0.0.0 promisc up
sudo ifconfig eth0 0.0.0.0 promisc up

sudo brctl addif br0-gns3-cloud tap-gns3vm-cloud # attach one side of bridge adapter to host tap
sudo brctl addif br0-gns3-cloud eth0 # attach other side of bridge adapter to "host" itself

sudo ifconfig br0-gns3-cloud up #tbd if bridge adapter survives reboot... I'm not sure yet
sudo ifconfig br0-gns3-cloud 10.10.10.99/24 # nor do I know if the bridge's IP/mask surives a reboot

# sudo route add default gw 10.10.10.254 # create a default internal network route for the bridge
  • add the new tap interface to GNS3
    cnossprac1netsec-2023-02-24-9.png

  • create a default static route between the router and the host network

ip route 0.0.0.0 0.0.0.0 f0/0
  • flush tap interface (for troubleshooting)
sudo ip addr flush tap-gns3 
  • checking which routes exists already and deleting (for troubleshooting)
route -nv
sudo route del -net 192.168.3.0 netmask 255.255.255.0 gw 192.168.1.1
  • removing tap adapters (for troubleshooting)
sudo ip tuntap del dev tap-gns3-cloud 
  • yields:
    cnossprac1netsec-2023-03-09-1.png

Add more interfaces to KVM bridge (virbr0)
...

problem is that interfaces from host are not exposed to GNS3 VM
...

Hence why GNS3 only sees this eth0 and not my actual enp4s0 ethernet adapter
...

  • tap interface on host to VM
sudo ip tuntap add dev tap-gns3 mode tap user root #${whoami}
sudo ifconfig enp4s0 0.0.0.0 promisc up
sudo ip link set tap-gns3 up

sudo brctl addbr tap-gns3-cloud-bridge
sudo brctl addif tap-gns3-cloud-bridge tap-gns3
sudo brctl addif tap-gns3-cloud-bridge enp4s0

sudo ifconfig tap-gns3-cloud-bridge up

sudo ifconfig tap-gns3-cloud-bridge 192.168.3.6/24

#sudo ip addr add 192.168.3.6/24 dev tap-gns3
sudo route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.3.6
  • ifconfig should yield...

  • configuring GNS3 internal topology to have the same network as host

enable
config

! allow the router to receive pings and send an SMTP response back
! or rather, allow all traffic coming from the host's gateway
access-list 101 permit ip 192.168.2.0 0.0.0.255 any

! create a route in the router to the host PC 192.168.2.0/24 subnet
ip route 192.168.3.0 255.255.255.0 192.168.3.6

! add the IP for the router's interface
interface GigabitEthernet0/1
 ip address 192.168.2.5 255.255.255.0
!  

And at some point I decided this was getting out of hand
...

  • so after spending more time than I should honestly have on trying to figure out why I can't create a tap interface straight into GNS3 from the Linux host
  • it occurred to me that this is because I have to bridge the linux host's network into KVM where GNS3 lives
    • problem: GNS3 expects to have tap adapters connected to itself wherever it is running from
    • When one would wish to connect an adapter from a Linux host on KVM into GNS3 they can try to add the linux adapter as I have added in this script
#!/bin/bash
echo "Creating TAP interfaces for GNS3 VM"
sudo ip tuntap add dev tap-gns3vm mode tap user $(whoami)
sudo ip link set tap-gns3vm up
sudo brctl addif virbr0 tap-gns3vm

# Tap interface for direct host connectivity
echo "Creating TAP interface for host"
sudo ip tuntap add dev tap-gns3host mode tap user $(whoami)
sudo ip addr add 192.168.3.1/24 dev tap-gns3host
sudo ip link set tap-gns3host up

# Give the interface and device some time to recognize each other
sleep 5s

echo "Starting gns3 vm..."
sudo qemu-system-x86_64 \
-name "GNS3 VM" \
-m 16384M \
-cpu host \
-enable-kvm \
-machine smm=off \
-boot order=c \
-drive file="/var/lib/libvirt/images/gns3-cnoss/GNS3 VM-disk001.qcow2",if=virtio,index=0,media=disk \
-drive file="/var/lib/libvirt/images/gns3-cnoss/GNS3 VM-disk002.qcow2",if=virtio,index=1,media=disk \
-device virtio-net-pci,netdev=nic0 -netdev tap,id=nic0,ifname=tap-gns3vm,script=no,downscript=no \
-device virtio-net-pci,netdev=nic1 -netdev tap,id=nic1,ifname=tap-gns3host,script=no,downscript=no

echo "GNS3 VM Should be started now"
  • Second problem:

    • GNS3 will see that I have added this new virtio-net-pci device, but not that it is a TAP adapter, it just sees that I have some mysterious new eth1 device inside of the VM
    • for all reasons enigmatic to me, even after connecting a router in GNS3 to this TAP disguised as eth1, with an IP of 192.168.3.1 assigned outside and inside the VM and failing to ping anywhere after adding routes on the host, routes in the router etc etc
  • I had a magical thought

    Why am I even trying to run this in KVM on Linux in the first place when the whole point of running GNS3 in a VM is to get access to KVM (mainly for windows users)??
  • so at this point I just scrapped the VM because this nested networking stuff was getting ridiculous just to have my topology talk to the host OS, and GNS3 was clearly designed to do this more easily on windows when it's running in VMWARE or Virtualbox

Layout Network Topology
...

  • essentially there will be some subnet connected to another VIA two routers in between.

  • there will be an IPsec VPN between the two routers

  • ipsec is chosen because it offers good access to cryptographic protocols for packets flowing through the routers vs. traditional tunnel routing
    - What is IPsec? | How IPsec VPNs work | Cloudflare
    - transport mode is chosen here because of the ability to at least packet capture headers and see where packets are destined for
    - Cisco IOS VPN Configuration Guide - Site-to-Site and Extranet VPN Business Scenarios
    - if the routers are configured in full tunnel mode it is probably more secure, but also more restrictive and more difficult to troubleshoot
    cnossprac1netsec-2023-03-12-1.png

  • Behind the second router will be an ASA firewall that will prevent any traffic that isn't VPN based from making its way into the secondary subnet

  • something like this will be the flow of traffic
    cnossprac1netsec-2023-03-12.png

VPN Tunnel Configuration Trial and Error
...

ISAKMP, IPsec, Interfaces, Basic Router things
...

  • interfaces and hostname, no annoying banners on the C7200 that present in IOSv
  • establishing a first subnet
! Set an identifiable hostname
hostname vpnrouter1
!
! Interface for the 10.10.10.0/24 subnet
interface GigabitEthernet0/0
 ip address 10.10.10.1 255.255.255.0
 no shut
 duplex auto
 speed auto
!
! Interface for the connection to the second router
interface GigabitEthernet1/0
 ip address 192.168.1.1 255.255.255.0
 no shut
 duplex auto
 speed auto
  • Internet Security Association and Key Management Protocol
  • creates a new isakmp policy with priority 1
  • using aes encryption, (Diffie hellman group 2)
  • key is pass@word1, and is the key for the IP of the interface of Router 2
  • telling the router that we're using ipsec and isakmp
    • this "mapping" here is called routermap1
    • the peer router is 192.168.1.2
    • the transform set is routerset1
    • and this VPN routing will be applied to whatever access list is part of 101
      • in this case traffic from 10.10.10.0/24 will be allowed to 10.10.20.0/24
! initial VPN setup
crypto isakmp policy 1
 encr aes
 authentication pre-share
 group 2
crypto isakmp key pass@word1 address 192.168.1.2
!
!
! Specifying that the VPN configuration is IPsec transform
crypto ipsec transform-set routerset1 esp-aes esp-sha-hmac
!
!
crypto map routermap1 10 ipsec-isakmp
 set peer 192.168.1.2
 set transform-set routerset1
 match address 101
! permitting traffic from inside network to other inside network
!access-list 101 permit ip 10.10.10.0 0.0.0.255 10.10.20.0 0.0.0.255
access-list 101 permit ip 10.10.10.0 0.0.0.255 10.10.30.0 0.0.0.255
!
  • we also need to provide a route in Router 1 that tells it where the 10.10.20.0/24 subnet actually is (it's behind the outbound interface of the second router)
ip route 10.10.20.0 255.255.255.0 192.168.1.2
ip route 10.10.30.0 255.255.255.0 192.168.1.2
  • apply crypto map to inbound interface of second router
interface GigabitEthernet1/0
crypto map routermap1

ISAKMP VPN tunnel verification
...

Verify VPN Tunnel:

  1. Verify the status of the VPN tunnel with the "show crypto isakmp sa" command. This command displays the current state of the ISAKMP SA (Security Association) for the VPN tunnel. If the state is "QM_IDLE," it means that the IPsec SA (Security Association) is established:

    R1# show crypto isakmp sa

  • how it looks on solarputty on windows
    cnossprac1netsec-2023-03-20-1.png
  1. Verify that the IPsec transform set is configured with the "show crypto ipsec transform-set" command. This command displays the transform sets that are configured for IPsec. If the transform set that is used by the VPN tunnel is configured for IPsec, it means that the VPN tunnel is using IPsec:

R2# show crypto ipsec transform-set

cnossprac1netsec-2023-03-20-2.png

Intermediate Router (ISP, etc)
...

  • considered having an intermediate router, but decided to scrap this since it wasn't really necessary
interface <ISP Router interface connected to Router 1>
 ip address <IP address>
!
interface <ISP Router interface connected to Firewall>
 ip address <IP address>
!
ip route 10.10.10.0 255.255.255.0 <IP address of Router 1 interface>
ip route 10.10.30.0 255.255.255.0 <IP address of Firewall interface>

Router 2
...

  • router 2 is doing basically the same thing as router 1, except the second half
  • it also needs to forward the tunnel onto the interface from the firewall
! Set an identifiable hostname
hostname vpnrouter2
!
interface GigabitEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 no shut
 duplex auto
 speed auto
!
interface GigabitEthernet1/0
 ip address 10.10.20.50 255.255.255.0
 no shut
 duplex auto
 speed auto
!
crypto isakmp policy 1
 encr aes
 authentication pre-share
 group 2
crypto isakmp key pass@word1 address 192.168.1.1
!crypto isakmp key pass@word1 address 10.10.20.254
crypto isakmp key pass@word1 address 10.10.30.1
!
crypto ipsec transform-set routerset2 esp-aes esp-sha-hmac
!
crypto map routermap2 10 ipsec-isakmp
 set peer 192.168.1.1
 set transform-set routerset2
 match address 101
!
! the permission set from Router 1 but in reverse
! access-list 101 permit ip 10.10.20.0 0.0.0.255 10.10.10.0 0.0.0.255
access-list 101 permit ip 10.10.30.0 0.0.0.255 10.10.10.0 0.0.0.255
!
  • the route to 10.10.10.0/24
ip route 10.10.10.0 255.255.255.0 192.168.1.1
  • the route to 10.10.30.0/24
ip route 10.10.30.0 255.255.255.0 10.10.20.254
  • apply crypto map to interface attached to first router (peer)
interface GigabitEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex full
 speed 1000
 media-type gbic
 negotiation auto
 crypto map routermap2
!
  • the crypto map for the interface facing the firewall
    • same transform-set so that esp-aes gets carried forward
crypto map routermap2firewall 10 ipsec-isakmp
 set peer 10.10.20.254
 set transform-set routerset2
 match address 101

interface GigabitEthernet1/0
 crypto map routermap2firewall
  • maybe I need an internal handover mapping as well
crypto map routermap2 internal 10 ipsec-isakmp
 set peer 10.10.20.50
 set transform-set routerset2
 match address 101
 

Quick Router 1 to Router 2 VPN encryption test
...

  • if I ping across router 1 and router 2 via the 10.10.10.0/24 subnet, my traffic should show encapsulating security payload (ESP) and not show the origin IP of the originating ping request, indicating that the original traffic is being protected by the VPN tunnel

cnossprac1netsec-2023-03-15.png

ASAv Firewall
...

Most of the content under here is notes in general about how ASAv firewalls can be configured in a more complex way, because the initial layout had the ASAv firewall as something in the chain of VPN rather than being a VPN traffic filter in between the two subnets, the final configuration is simpler as is explained below
  • syntax is slightly different for firewalls,
    • terminal needs to be specified
    • pager rather than length
configure terminal
terminal pager 0

enable telnet forcefully
...

en
sh flash:
sh disk0:
cd coredumpinfo

copy coredump.cfg disk0:/use_ttyS0

cnossprac1netsec-2023-03-14-9.png

  • reboot
    cnossprac1netsec-2023-03-14-10.png

  • now telnet console can be used for admin instead of VNC
    cnossprac1netsec-2023-03-14-11.png

  • initial configuration dialogue

  • security level of 100 (trusted needs to be set in order to telnet into it)
    cnossprac1netsec-2023-03-14-8.png

some user credentials notes
...

  • username admin password admin privilege 15

  • enable password admin

  • On G0/0 I'm calling the name of traffic coming from out side of the firewall external

    • and on G0/1 the traffic is "internal" for 10.10.20.0/24
  • security-level 0 just means that traffic coming from this outside interface is less trusted in general

  • enable communication with firewall over management interface (KVM style subnetting)

    • this was mostly to test if looking at the web interface was doable, turns out it wasn't really
interface Management0/0
ip address 192.168.122.50 255.255.255.0
no shutdown
exit

ASA routers have something called security-level
...

  • which determines the priority of traffic flow safety across interfaces
  • turn interfaces online
interface GigabitEthernet0/0
 nameif leftside
 security-level 100
 ip address 10.10.20.254 255.255.255.0
 no shut
!
interface GigabitEthernet0/1
 nameif rightside
 security-level 100
 ip address 10.10.30.1 255.255.255.0
 no shut
!

A mockup of something that would perhaps work if the ASAv was part of the VPN chain
...

this is grossly overcomplicated, but it's still in here because it was part of the learning experience, didn't use this but it was interesting to see what the additional crypto mapping capabilities of ASAv are
  • ASA firewalls can have crypto mappings, etc, applied in a similar fashion to how they are applied to routers

  • network objects refer to specific subnets

    • in this scenario the two subnets that are being paired via VPN are
      • 10.10.10.0/24 -- 10.10.30.0/24
    • An ACL is defined to permit traffic between the two subnets
    • the tunnel group is the initiating IP of the tunnel start point
    • they share that key defined earlier , doesn't matter much what it ispass@word1
object network obj_10.10.10.0
subnet 10.10.10.0 255.255.255.0
!
object network obj_10.10.30.0
subnet 10.10.30.0 255.255.255.0
!
access-list VPN_ACL extended permit ip object obj_10.10.10.0 object obj_10.10.30.0
! tunnel group peered from original router exit point
!
!tunnel-group 192.168.1.1 ipsec-attributes
!tunnel-group 192.168.1.1 type ipsec-l2l
!pre-shared-key pass@word1

tunnel-group 10.10.20.50 type ipsec-l2l
tunnel-group 10.10.20.50 ipsec-attributes
pre-shared-key pass@word1


! attaching parameters to crypto map
crypto map VPN_MAP 10 match address VPN_ACL
!crypto map VPN_MAP 10 set peer 192.168.1.1
crypto map VPN_MAP 10 set peer 10.10.20.50

crypto ipsec transform-set asafirewall esp-aes esp-sha-hmac
crypto map VPN_MAP 10 set ikev1 transform-set asafirewall
crypto map VPN_MAP interface leftside

! maybe need interface rightside?
crypto map VPN_MAP interface leftside
crypto map VPN_MAP interface rightside
  • need to add additional access lists for traffic between all subnets
object network obj_10.10.20.0
 subnet 10.10.20.0 255.255.255.0
!
access-list VPN_ACL extended permit ip object obj_10.10.10.0 object obj_10.10.20.0
access-list VPN_ACL extended permit ip object obj_10.10.20.0 object obj_10.10.10.0
!
crypto map VPN_MAP 10 match address VPN_ACL
  • can view that the crypto map is setup on router correctly with show crypto map VPN_MAP
  • can view similar on ASAv with
    • show run crypto map
    • show run crypto isakmp sa
    • `show crypto ipsec sa

cnossprac1netsec-2023-03-15-1.png

Some notes on failing Interacting with the ASAv web gui
...

in the end decided not to use this at all and it was kind of a waste of time
  • this is using some ancient java webstart stuff that isn't really a thing any more....

  • had to install this

sudo apt install icedtea-netx
  • had to manually edit the HTML of the thing to allow me to even get the file to run this java webapp
    cnossprac1netsec-2023-03-14.png

  • which would download a file which I can run with

javaws ./asdm.jnlp

cnossprac1netsec-2023-03-14-1.png

cnossprac1netsec-2023-03-14-2.png

cnossprac1netsec-2023-03-14-3.png

  • oh boy
    cnossprac1netsec-2023-03-14-4.png

  • so uh... maybe?? Download - openwebstart.com

  • icedtea is super deprecated so I'm going to try to get into it with this and see if that works

cnossprac1netsec-2023-03-14-5.png

cnossprac1netsec-2023-03-14-6.png

  • ah
    cnossprac1netsec-2023-03-14-7.png

  • I played with this for.... quite a while and decided it wasn't worth it

The actually implemented topology after a lot of trial and error
...

Scheme for site-to-site VPN
...

  • first test was to get a site to site VPN working with no firewall
    cnossprac1netsec-2023-03-15-2.png

  • another example of site-to-site without IOSvL2 switches
    cnossprac1netsec-2023-03-20-3.png

  • this was configured roughly the same as the above notes with ISAKMP and trial and error

Router 1
...

crypto isakmp policy 1
 encr aes
 authentication pre-share
 group 2
crypto isakmp key pass@word1 address 192.168.1.2
!
!
crypto ipsec transform-set routerset1 esp-aes esp-sha-hmac 
!
crypto map routermap1 10 ipsec-isakmp 
 set peer 192.168.1.2
 set transform-set routerset1 
 match address 101
!
interface GigabitEthernet0/0
 ip address 10.10.10.1 255.255.255.0
 duplex full
 speed 1000
 media-type gbic
 negotiation auto
!
interface GigabitEthernet1/0
 ip address 192.168.1.1 255.255.255.0
 negotiation auto
 crypto map routermap1
!
ip route 10.10.30.0 255.255.255.0 192.168.1.2
!
access-list 101 permit ip 10.10.10.0 0.0.0.255 10.10.30.0 0.0.0.255

Router 2
...

crypto isakmp policy 1
 encr aes
 authentication pre-share
 group 2
crypto isakmp key pass@word1 address 192.168.1.1
!
!
crypto ipsec transform-set routerset2 esp-aes esp-sha-hmac 
!
crypto map routermap2 10 ipsec-isakmp 
 set peer 192.168.1.1
 set transform-set routerset2 
 match address 101
!
crypto map routermap2firewall 10 ipsec-isakmp 
 set peer 10.10.20.254
 set peer 10.10.30.1
 set transform-set routerset2 
 match address 101
!
interface GigabitEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 duplex full
 speed 1000
 media-type gbic
 negotiation auto
 crypto map routermap2
!
interface GigabitEthernet1/0
 ip address 10.10.30.1 255.255.255.0
 negotiation auto
!
ip route 10.10.10.0 255.255.255.0 192.168.1.1
!
access-list 101 permit ip 10.10.30.0 0.0.0.255 10.10.10.0 0.0.0.255

VPN tested by wireshark packet capture
...

  • same as above in the quick configuration test

  • secure as long as the icmp pings are encapsulated by the ESP protocol and the originating IP is not known to the wireshark sniffer on line across the routers
    cnossprac1netsec-2023-03-15.png

  • what the same test looks like from solarputty instead of linux terminal telnet
    cnossprac1netsec-2023-03-20-4.png

Scheme site-to-site with intermediary firewall
...

-2023-03-15-3.png

  • in the site to site with intermediary firewall configuration some things were modified about peers and routes, but it was mostly the same for VPN setup

Router 1
...

  • these things were altered to make the Router 1 from above work with a firewall in between
no crypto isakmp key pass@word1 address 192.168.1.2
crypto isakmp key pass@word1 address 192.168.2.1

crypto map routermap1 10 ipsec-isakmp 
  set peer 192.168.2.1

no ip route 10.10.30.0 255.255.255.0 192.168.1.2
ip route 10.10.30.0 255.255.255.0 192.168.2.1

ip route 0.0.0.0 0.0.0.0 192.168.1.2

Firewall
...

  • the firewall was configured like so
    • this firewall is simply filtering traffic from the less trusted outward network to the more trusted inward network
    • this was opted for inside of trying a complicted crypto map that would make the firewall part of the VPN tunnel and lots of trial and error proved making that work difficult
hostname vpn-firewall
interface GigabitEthernet0/0
 nameif inside
 security-level 100
 ip address 192.168.1.2 255.255.255.0 
!
interface GigabitEthernet0/1
 nameif outside
 security-level 0
 ip address 192.168.2.2 255.255.255.0 
!
access-list out extended permit icmp host 192.168.2.1 host 192.168.1.1 
access-list out extended permit udp host 192.168.2.1 host 192.168.1.1 eq isakmp 
access-list out extended permit esp host 192.168.2.1 host 192.168.1.1 
! access-group out in interface outside

Router 2
...

  • router 2 is the same as above with these small changes
no crypto map routermap2firewall 10 ipsec-isakmp 

interface GigabitEthernet0/0
ip address 192.168.2.1 255.255.255.0

Ping test across check for encapsulated packets
...

  • ping across from one virtual PC to another
    "-2023-03-15-2.png" is not created yet. Click to create.

  • PC1
    cnossprac1netsec-2023-03-15-3.png

  • intermediate wireshark capture on both ends of firewall
    cnossprac1netsec-2023-03-15-4.png

  • received data on PC2
    cnossprac1netsec-2023-03-15-5.png

Some full configuration dumps of Router 1 , Router 2, and the Firewall
...

Router 1
...

R1-C1#show running-config 
Building configuration...

Current configuration : 1657 bytes
!
upgrade fpd auto
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1-C1
!
boot-start-marker
boot-end-marker
!
logging message-counter syslog
!
no aaa new-model
ip source-route
no ip icmp rate-limit unreachable
ip cef
!
!
no ip domain lookup
no ipv6 cef
!
multilink bundle-name authenticated
!
!
!
archive
 log config
  hidekeys
! 
!
crypto isakmp policy 1
 encr aes
 authentication pre-share
 group 2
crypto isakmp key pass@word1 address 192.168.2.1
!
!
crypto ipsec transform-set routerset1 esp-aes esp-sha-hmac 
!
crypto map routermap1 10 ipsec-isakmp 
 set peer 192.168.2.1
 set transform-set routerset1 
 match address 101
!
!
!
ip tcp synwait-time 5
!
!
!
!
interface Ethernet0/0
 no ip address
 shutdown
 duplex auto
!
interface GigabitEthernet0/0
 ip address 10.10.10.1 255.255.255.0
 duplex full
 speed 1000
 media-type gbic
 negotiation auto
!
interface GigabitEthernet1/0
 ip address 192.168.1.1 255.255.255.0
 negotiation auto
 crypto map routermap1
!
interface GigabitEthernet2/0
 no ip address
 shutdown
 negotiation auto
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 192.168.1.2
ip route 10.10.30.0 255.255.255.0 192.168.2.1
no ip http server
no ip http secure-server
!
!
!
access-list 101 permit ip 10.10.10.0 0.0.0.255 10.10.30.0 0.0.0.255
no cdp log mismatch duplex
!
control-plane
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line vty 0 4
 login
!
end

Firewall
...

vpn-firewall# show running-config 
: Saved

: 
: Serial Number: 9AAADS8T1G9
: Hardware:   ASAv, 2048 MB RAM, CPU Unknown Model 2304 MHz
:
ASA Version 9.8(1) 
!
hostname vpn-firewall
enable password $sha512$5000$Jy/TNZdjhOAE58YQ1g+FXA==$IqQfAVlwNoZrSCfX3b1zYQ== pbkdf2
xlate per-session deny tcp any4 any4
xlate per-session deny tcp any4 any6
xlate per-session deny tcp any6 any4
xlate per-session deny tcp any6 any6
xlate per-session deny udp any4 any4 eq domain
xlate per-session deny udp any4 any6 eq domain
xlate per-session deny udp any6 any4 eq domain
xlate per-session deny udp any6 any6 eq domain
names

!
interface GigabitEthernet0/0
 nameif inside
 security-level 100
 ip address 192.168.1.2 255.255.255.0 
!
interface GigabitEthernet0/1
 nameif outside
 security-level 0
 ip address 192.168.2.2 255.255.255.0 
!
interface GigabitEthernet0/2
 shutdown
 no nameif
 no security-level
 no ip address
!
interface GigabitEthernet0/3
 shutdown
 no nameif
 no security-level
 no ip address
!
interface GigabitEthernet0/4
 shutdown
 no nameif
 no security-level
 no ip address
!
interface GigabitEthernet0/5
 shutdown
 no nameif
 no security-level
 no ip address
!
interface GigabitEthernet0/6
 shutdown
 no nameif
 no security-level
 no ip address
!
interface Management0/0
 shutdown
 no nameif
 no security-level
 no ip address
!
ftp mode passive
access-list out extended permit icmp host 192.168.2.1 host 192.168.1.1 
access-list out extended permit udp host 192.168.2.1 host 192.168.1.1 eq isakmp 
access-list out extended permit esp host 192.168.2.1 host 192.168.1.1 
pager lines 23
mtu inside 1500
mtu outside 1500
no failover
no monitor-interface service-module 
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
no arp permit-nonconnected
arp rate-limit 8192
access-group out in interface outside
timeout xlate 3:00:00
timeout pat-xlate 0:00:30
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 sctp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
timeout floating-conn 0:00:00
timeout conn-holddown 0:00:15
timeout igp stale-route 0:01:10
user-identity default-domain LOCAL
aaa authentication login-history
no snmp-server location
no snmp-server contact
crypto ipsec security-association pmtu-aging infinite
crypto ca trustpoint _SmartCallHome_ServerCA
 no validation-usage
 crl configure
crypto ca trustpool policy
 auto-import
crypto ca certificate chain _SmartCallHome_ServerCA
 certificate ca 18dad19e267de8bb4a2158cdcc6b3b4a
    308204d3 308203bb a0030201 02021018 dad19e26 7de8bb4a 2158cdcc 6b3b4a30 
    0d06092a 864886f7 0d010105 05003081 ca310b30 09060355 04061302 55533117 
    30150603 55040a13 0e566572 69536967 6e2c2049 6e632e31 1f301d06 0355040b 
    13165665 72695369 676e2054 72757374 204e6574 776f726b 313a3038 06035504 
    0b133128 63292032 30303620 56657269 5369676e 2c20496e 632e202d 20466f72 
    20617574 686f7269 7a656420 75736520 6f6e6c79 31453043 06035504 03133c56 
    65726953 69676e20 436c6173 73203320 5075626c 69632050 72696d61 72792043 
    65727469 66696361 74696f6e 20417574 686f7269 7479202d 20473530 1e170d30 
    36313130 38303030 3030305a 170d3336 30373136 32333539 35395a30 81ca310b 
    30090603 55040613 02555331 17301506 0355040a 130e5665 72695369 676e2c20 
    496e632e 311f301d 06035504 0b131656 65726953 69676e20 54727573 74204e65 
    74776f72 6b313a30 38060355 040b1331 28632920 32303036 20566572 69536967 
    6e2c2049 6e632e20 2d20466f 72206175 74686f72 697a6564 20757365 206f6e6c 
    79314530 43060355 0403133c 56657269 5369676e 20436c61 73732033 20507562 
    6c696320 5072696d 61727920 43657274 69666963 6174696f 6e204175 74686f72 
    69747920 2d204735 30820122 300d0609 2a864886 f70d0101 01050003 82010f00 
    3082010a 02820101 00af2408 08297a35 9e600caa e74b3b4e dc7cbc3c 451cbb2b 
    e0fe2902 f95708a3 64851527 f5f1adc8 31895d22 e82aaaa6 42b38ff8 b955b7b1 
    b74bb3fe 8f7e0757 ecef43db 66621561 cf600da4 d8def8e0 c362083d 5413eb49 
    ca595485 26e52b8f 1b9febf5 a191c233 49d84363 6a524bd2 8fe87051 4dd18969 
    7bc770f6 b3dc1274 db7b5d4b 56d396bf 1577a1b0 f4a225f2 af1c9267 18e5f406 
    04ef90b9 e400e4dd 3ab519ff 02baf43c eee08beb 378becf4 d7acf2f6 f03dafdd 
    75913319 1d1c40cb 74241921 93d914fe ac2a52c7 8fd50449 e48d6347 883c6983 
    cbfe47bd 2b7e4fc5 95ae0e9d d4d143c0 6773e314 087ee53f 9f73b833 0acf5d3f 
    3487968a ee53e825 15020301 0001a381 b23081af 300f0603 551d1301 01ff0405 
    30030101 ff300e06 03551d0f 0101ff04 04030201 06306d06 082b0601 05050701 
    0c046130 5fa15da0 5b305930 57305516 09696d61 67652f67 69663021 301f3007 
    06052b0e 03021a04 148fe5d3 1a86ac8d 8e6bc3cf 806ad448 182c7b19 2e302516 
    23687474 703a2f2f 6c6f676f 2e766572 69736967 6e2e636f 6d2f7673 6c6f676f 
    2e676966 301d0603 551d0e04 1604147f d365a7c2 ddecbbf0 3009f343 39fa02af 
    33313330 0d06092a 864886f7 0d010105 05000382 01010093 244a305f 62cfd81a 
    982f3dea dc992dbd 77f6a579 2238ecc4 a7a07812 ad620e45 7064c5e7 97662d98 
    097e5faf d6cc2865 f201aa08 1a47def9 f97c925a 0869200d d93e6d6e 3c0d6ed8 
    e6069140 18b9f8c1 eddfdb41 aae09620 c9cd6415 3881c994 eea28429 0b136f8e 
    db0cdd25 02dba48b 1944d241 7a05694a 584f60ca 7e826a0b 02aa2517 39b5db7f 
    e784652a 958abd86 de5e8116 832d10cc defda882 2a6d281f 0d0bc4e5 e71a2619 
    e1f4116f 10b595fc e7420532 dbce9d51 5e28b69e 85d35bef a57d4540 728eb70e 
    6b0e06fb 33354871 b89d278b c4655f0d 86769c44 7af6955c f65d3208 33a454b6 
    183f685c f2424a85 3854835f d1e82cf2 ac11d6a8 ed636a
  quit
telnet timeout 5
ssh stricthostkeycheck
ssh timeout 5
ssh key-exchange group dh-group1-sha1
console timeout 0
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
dynamic-access-policy-record DfltAccessPolicy
!
class-map inspection_default
 match default-inspection-traffic
!
!
policy-map type inspect dns migrated_dns_map_1
 parameters
  message-length maximum client auto
  message-length maximum 512
  no tcp-inspection
policy-map global_policy
 class inspection_default
  inspect dns migrated_dns_map_1 
  inspect ftp 
  inspect h323 h225 
  inspect h323 ras 
  inspect ip-options 
  inspect netbios 
  inspect rsh 
  inspect rtsp 
  inspect skinny  
  inspect esmtp 
  inspect sqlnet 
  inspect sunrpc 
  inspect tftp 
  inspect sip  
  inspect xdmcp 
policy-map type inspect dns migrated_dns_map_2
 parameters
  message-length maximum client auto
  message-length maximum 512
  no tcp-inspection
!
service-policy global_policy global
prompt hostname context 
call-home
 profile CiscoTAC-1
  no active
  destination address http https://tools.cisco.com/its/service/oddce/services/DDCEService
  destination address email callhome@cisco.com
  destination transport-method http
  subscribe-to-alert-group diagnostic
  subscribe-to-alert-group environment
  subscribe-to-alert-group inventory periodic monthly
  subscribe-to-alert-group configuration periodic monthly
  subscribe-to-alert-group telemetry periodic daily
 profile License
  destination address http https://tools.cisco.com/its/service/oddce/services/DDCEService
  destination transport-method http
Cryptochecksum:e3f109b5557f5bbdc77df280e0748cef
: end

Router 2
...

R2-C1#show running-config 
Building configuration...

Current configuration : 1731 bytes
!
upgrade fpd auto
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2-C1
!
boot-start-marker
boot-end-marker
!
logging message-counter syslog
!
no aaa new-model
ip source-route
no ip icmp rate-limit unreachable
ip cef
!
!
!
!
no ip domain lookup
no ipv6 cef
!
multilink bundle-name authenticated
!
!
archive
 log config
  hidekeys
! 
!
crypto isakmp policy 1
 encr aes
 authentication pre-share
 group 2
crypto isakmp key pass@word1 address 192.168.1.1
!
!
crypto ipsec transform-set routerset2 esp-aes esp-sha-hmac 
!
crypto map routermap2 10 ipsec-isakmp 
 set peer 192.168.1.1
 set transform-set routerset2 
 match address 101
!
!
!
ip tcp synwait-time 5
!
interface Ethernet0/0
 no ip address
 shutdown
 duplex auto
!
interface GigabitEthernet0/0
 ip address 192.168.2.1 255.255.255.0
 duplex full
 speed 1000
 media-type gbic
 negotiation auto
 crypto map routermap2
!
interface GigabitEthernet1/0
 ip address 10.10.30.1 255.255.255.0
 negotiation auto
!
interface GigabitEthernet2/0
 no ip address
 shutdown
 negotiation auto
!
interface GigabitEthernet3/0
 no ip address
 shutdown
 negotiation auto
!
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 192.168.2.2
ip route 10.10.10.0 255.255.255.0 192.168.1.1
no ip http server
no ip http secure-server
!
!
!
access-list 101 permit ip 10.10.30.0 0.0.0.255 10.10.10.0 0.0.0.255
no cdp log mismatch duplex
!
control-plane
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line vty 0 4
 login
!
end