Tags:
#cisco , #router, #switch, #Network , #vpn , #gns3, #dynamips, #vios, #ios, #virtual-machine , #virtualization , #CCNA
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.
c7200-adventerprisek9-mz.124-24.T5.image
gns3-cnoss
gns3server
gns3server --local
gns3-cnoss-taphost
show running-config
show ip interface brief
show access-lists
show ip route
config-register 0x2102
show crypto map <mapname>
<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
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
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
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
#!/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
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..."
[....]
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
yieldsbridge name bridge id STP enabled interfaces
virbr0 8000.525400ca8e4c yes tap-gns3vm
gns3-cnoss
, http://192.168.122.76:80 web GUI accessping 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
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
router response
final personal test was seeing if I could ping and ssh to my local server, yeah looks good, bridge is working correctly
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
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
run gns3server
, only if you want to test local virtual networks, but without good hardware virtualization support
need to add "remote" server in order to connect to VM
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)
sudo apt install gns3-server
# wireshark docker
sudo usermod -aG ubridge yorionathan
sudo usermod -aG libvirt yorionathan
sudo usermod -aG kvm yorionathan
gns3server
datasheet says default onboard memory for these is 512 MB
so that's what was set
the gns3 documentation says...
okay so none of these bins are in their recommended categories...
and they don't support catalyst switches at all
annnnd of course the C2960 is a catalyst switch
annnnd the ASA 5505 is a supported version... but they recommend not to use these as the consume all of CPU
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 terminalterminal length 0
is enabled, for single screenBuilding 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
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
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
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
./dump_config_nopass.expect 192.168.122.76 5003 switch_dump.txt
using meld to visually compare the lines of the different config files
notes
since it appears all interfaces are already on, most important part is
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
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
!
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
sudo apt install expect
#!/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
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>
./dump_config.expect 192.168.122.76 5002 "" "" config_dump.txt
./dump_config_nopass.expect 192.168.122.76 5002 config_dump.txt
expect
function to wait for the buffer to actually dump something useful before writing it to an output fileexpect {
"#$"
{set output $expect_out(buffer)}
timeout
{send_user "Error: Timeout waiting for command output\n"; exit 1}
}
#!/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
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
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
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...
something of this nature is needed in order to create a network mockup inside of GNS3 that can talk to devices outside of the GNS3 VM configuration
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
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
create a default static route between the router and the host network
ip route 0.0.0.0 0.0.0.0 f0/0
sudo ip addr flush tap-gns3
route -nv
sudo route del -net 192.168.3.0 netmask 255.255.255.0 gw 192.168.1.1
sudo ip tuntap del dev tap-gns3-cloud
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
!
#!/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:
I had a magical thought
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
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
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
! 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
pass@word1
, and is the key for the IP of the interface of Router 2routermap1
192.168.1.2
routerset1
101
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
!
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
interface GigabitEthernet1/0
crypto map routermap1
Verify VPN Tunnel:
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
R2# show crypto ipsec transform-set
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>
! 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
!
ip route 10.10.10.0 255.255.255.0 192.168.1.1
ip route 10.10.30.0 255.255.255.0 10.10.20.254
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
!
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
crypto map routermap2 internal 10 ipsec-isakmp
set peer 10.10.20.50
set transform-set routerset2
match address 101
pager
rather than length
configure terminal
terminal pager 0
en
sh flash:
sh disk0:
cd coredumpinfo
copy coredump.cfg disk0:/use_ttyS0
reboot
now telnet console can be used for admin instead of VNC
initial configuration dialogue
security level of 100 (trusted needs to be set in order to telnet into it)
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
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)
interface Management0/0
ip address 192.168.122.50 255.255.255.0
no shutdown
exit
security-level
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
!
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
pass@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
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
show crypto map VPN_MAP
show run crypto map
show run crypto isakmp sa
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
which would download a file which I can run with
javaws ./asdm.jnlp
oh boy
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
ah
I played with this for.... quite a while and decided it wasn't worth it
first test was to get a site to site VPN working with no firewall
another example of site-to-site without IOSvL2 switches
this was configured roughly the same as the above notes with ISAKMP and trial and error
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
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
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
what the same test looks like from solarputty instead of linux terminal telnet
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
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
no crypto map routermap2firewall 10 ipsec-isakmp
interface GigabitEthernet0/0
ip address 192.168.2.1 255.255.255.0
ping across from one virtual PC to another
PC1
intermediate wireshark capture on both ends of firewall
received data on PC2
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
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
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