Wednesday, April 22, 2020

How to do Source AND Destination NAT on the same router



How to do Source AND Destination NAT on the same router

(I used https://blog.ine.com/2008/02/15/the-inside-and-outside-of-nat as a reference. But it uses Frame Relay, I wanted to do the same for Ethernet.)

Setup:
            OUTSIDE                            INSIDE

R1-10.0.28.65------10.0.28.66-R2-172.16.24.2------------172.16.24.1-R3

Traffic is originated from the OUTSIDE first.

Config of R2:
interface Gi1
  ip address 10.0.28.66 255.255.255.252
  ip nat outside

interface Gi2
  ip address 172.16.24.2 255.255.255.0
  ip nat inside

! NAT translation is bidirectional. Traffic from outside to inside with a
! Destination of 10.0.28.66 will also hit this rule, even if it says " inside
! source"
ip nat inside source static  172.16.24.1 10.0.28.66


! Reply traffic from inside to outside -> Router R2 does first a route lookup ,then
! NAT translation. This means that the we cannot use 172.16.24.2 as a source
! static translation. The return packet will arrive on R3 and he will see it as 
! local and not even do the NAT translation. By using 172.16.245.25.100 and adding ! a static route towards 10.0.28.65, the route lookup will be done and then the 
! NAT translation.

ip nat outside source static 10.0.28.65 172.16.25.100
ip route 172.16.24.254 255.255.255.255 10.0.28.65

(it may be necessary to announce 172.16.25.100 in the rest of the network for the traffic to find it's way back to R2)






???
inside local    inside global     outside local   outside global
172.16.24.1     10.0.28.66        172.16.24.2     10.0.28.65
????

Friday, February 14, 2020

ping between VMs on same distributed port group / virtual switch doesn't work


Check if they are on the same physical hosts in ESXi. If not, move them to the same host and see if ping works. If it does, then the problem is on the physical switch connecting the 2 hosts. For example, VLAN not added in the trunk.

Tuesday, November 26, 2019

eve-ng upload file from AWS workspace to eve-ng docker.io-linux-vm inside a lab


1) start eve-ng with HTML5 Desktop. Upload file via GUACD folder in thinclient (details in eve-ng cookbook)
2)copy file to Desktop in HTML5 Desktop GUI
3)start terminal of docker.io-linux-vm in the lab to find it's 172.x.x.x IP address
4)In HTML5 Desktop GUI do a sftp to this address


Monday, March 25, 2019

Ubuntu: X11, gdm3

as root:
systemctl start gdm3
as non-root:
sudo x11vnc -auth /run/user/123/gdm/Xauthority -ncache 10 -display :0



/etc/gdm3/Init/Default
/usr/bin/x11vnc -rfbauth /root/.vnc/passwd -o /var/log/x11vnc.log -forever -bg

Thursday, March 14, 2019

Arista Zero Touch Provisioning


zerotouch cancel -> only for current uptime (reload will start ZTP again)
zerotouch disable -> forever

to reenable zerotouch do:
bash
rm /mnt/flash/zerotouch-config
exit
write erase
reload

(ztpserver freeware latest development version is needed)


on vEOS:
localhost login: Mar 14 12:53:44 localhost ConfigAgent: %ZTP-6-DHCPv4_SUCCESS: DHCPv4 response received on Management1  [ Ip Address: 11.0.0.3/24/24; Gateway: 11.0.0.1; Boot File: http://54.37.190.249:8080/bootstrap ]
Mar 14 12:53:49 localhost ConfigAgent: %ZTP-6-CONFIG_DOWNLOAD: Attempting to download the startup-config from http://54.37.190.249:8080/bootstrap
Mar 14 12:53:49 localhost ConfigAgent: %ZTP-6-CONFIG_DOWNLOAD_SUCCESS: Successfully downloaded config script from http://54.37.190.249:8080/bootstrap
Mar 14 12:53:49 localhost ConfigAgent: %ZTP-6-EXEC_SCRIPT: Executing the downloaded config script
Mar 14 12:53:56 localhost ConfigAgent: %ZTP-6-EXEC_SCRIPT_SUCCESS: Successfully executed the downloaded config script
Mar 14 12:53:57 localhost ConfigAgent: %ZTP-6-RELOAD: Rebooting the system


on ZTPserver:
2019-03-14 13:53:51,096:DEBUG:[serializers:237] None: reading /usr/share/ztpserver/bootstrap/bootstrap...
2019-03-14 13:53:51,102:INFO:[controller:820] 178.32.46.58: node beginning provisioning
178.32.46.58 - - [14/Mar/2019 13:53:51] "GET /bootstrap HTTP/1.1" 200 48535
2019-03-14 13:53:52,308:DEBUG:[serializers:237] None: reading /usr/share/ztpserver/bootstrap/bootstrap.conf...
2019-03-14 13:53:52,309:WARNING:[controller:776] Bootstrap config file empty
178.32.46.58 - - [14/Mar/2019 13:53:52] "GET /bootstrap/config HTTP/1.1" 200 27
2019-03-14 13:53:55,271:INFO:[controller:277] 178.32.46.58: received system information from node:
{u'neighbors': {}, u'model': u'vEOS', u'version': u'4.21.1.1F', u'serialnumber': u'', u'systemmac': u'50:05:00:93:81:07'}
2019-03-14 13:53:55,272:INFO:[topology:313] 500500938107: parsing node's LLDP Neighbor information
2019-03-14 13:53:55,272:DEBUG:[topology:159] 500500938107: created node object Node(serialnumber=, systemmac=500500938107, neighbors=OrderedCollection())
2019-03-14 13:53:55,272:INFO:[controller:295] 178.32.46.58: node ID is systemmac:500500938107
2019-03-14 13:53:55,272:DEBUG:[controller:169] 500500938107: running node_exists
2019-03-14 13:53:55,272:INFO:[controller:324] 500500938107: this node already exists on the server
2019-03-14 13:53:55,272:DEBUG:[controller:169] 500500938107: running dump_node
2019-03-14 13:53:55,272:DEBUG:[serializers:270] N/A: writing /usr/share/ztpserver/nodes/500500938107/.node...
2019-03-14 13:53:55,273:INFO:[controller:520] 500500938107: node data written to nodes/500500938107/.node:
{'neighbors': {}, 'model': u'vEOS', 'version': u'4.21.1.1F', 'systemmac': '500500938107'}
2019-03-14 13:53:55,273:DEBUG:[controller:169] 500500938107: running set_location
2019-03-14 13:53:55,273:DEBUG:[controller:181] 500500938107: response to set_location: {'status': 409, 'location': 'nodes/500500938107'}
178.32.46.58 - - [14/Mar/2019 13:53:55] "POST /nodes HTTP/1.1" 409 0
2019-03-14 13:53:55,282:INFO:[controller:558] 500500938107: received request for definition: http://54.37.190.249:8080/nodes/500500938107
2019-03-14 13:53:55,282:DEBUG:[controller:559] GET /nodes/500500938107 HTTP/1.1
Accept: */*
Accept-Encoding: identity
Connection: keep-alive
Content-Length: 4
Content-Type: text/html
Host: 54.37.190.249:8080
User-Agent: python-requests/2.18.4

null
Resource: 500500938107

2019-03-14 13:53:55,283:DEBUG:[serializers:237] None: reading /usr/share/ztpserver/nodes/500500938107/.node...
2019-03-14 13:53:55,283:INFO:[topology:313] 500500938107: parsing node's LLDP Neighbor information
2019-03-14 13:53:55,283:DEBUG:[topology:159] 500500938107: created node object Node(serialnumber=None, systemmac=500500938107, neighbors=OrderedCollection())
2019-03-14 13:53:55,283:DEBUG:[controller:169] 500500938107: running do_validation
2019-03-14 13:53:55,283:WARNING:[controller:604] 500500938107: topology validation is DISABLED
2019-03-14 13:53:55,283:DEBUG:[controller:169] 500500938107: running get_startup_config
2019-03-14 13:53:55,284:DEBUG:[controller:169] 500500938107: running get_definition
2019-03-14 13:53:55,284:WARNING:[controller:664] 500500938107: missing definition nodes/500500938107/definition
2019-03-14 13:53:55,284:DEBUG:[controller:169] 500500938107: running get_attributes
2019-03-14 13:53:55,284:WARNING:[controller:683] 500500938107: no node specific attributes file
2019-03-14 13:53:55,284:DEBUG:[controller:169] 500500938107: running do_substitution
2019-03-14 13:53:55,284:DEBUG:[controller:703] 500500938107: processing action install static startup-config file (variable substitution)
2019-03-14 13:53:55,284:DEBUG:[controller:169] 500500938107: running do_resources
2019-03-14 13:53:55,288:DEBUG:[topology:166] 500500938107: computing resources (attr={'url': 'http://54.37.190.249:8080/nodes/500500938107/startup-config'})
2019-03-14 13:53:55,289:DEBUG:[topology:194] 500500938107: resources: {'url': 'http://54.37.190.249:8080/nodes/500500938107/startup-config'}
2019-03-14 13:53:55,289:DEBUG:[controller:169] 500500938107: running finalize_response
2019-03-14 13:53:55,289:DEBUG:[controller:181] 500500938107: response to finalize_response: {'body': {'name': 'Autogenerated definition', 'actions': [{'action': 'replace_config', 'attributes': {'url': 'http://54.37.190.249:8080/nodes/500500938107/startup-config'}, 'name': 'install static startup-config file', 'always_execute': True}]}, 'status': 200, 'content_type': 'application/json'}
178.32.46.58 - - [14/Mar/2019 13:53:55] "GET /nodes/500500938107 HTTP/1.1" 200 235
2019-03-14 13:53:55,298:DEBUG:[controller:142] GET /actions/replace_config HTTP/1.1
Accept: */*
Accept-Encoding: identity
Connection: keep-alive
Content-Length: 4
Content-Type: text/html
Host: 54.37.190.249:8080
User-Agent: python-requests/2.18.4

null
Resource: replace_config

2019-03-14 13:53:55,298:DEBUG:[serializers:237] None: reading /usr/share/ztpserver/actions/replace_config...
178.32.46.58 - - [14/Mar/2019 13:53:55] "GET /actions/replace_config HTTP/1.1" 200 2364
2019-03-14 13:53:55,307:DEBUG:[controller:188] 500500938107: node resource GET request: 
GET /nodes/500500938107/startup-config HTTP/1.1
Accept: */*
Accept-Encoding: identity
Connection: keep-alive
Content-Length: 4
Content-Type: text/html
Host: 54.37.190.249:8080
User-Agent: python-requests/2.18.4

null

2019-03-14 13:53:55,307:DEBUG:[serializers:237] None: reading /usr/share/ztpserver/nodes/500500938107/startup-config...
178.32.46.58 - - [14/Mar/2019 13:53:55] "GET /nodes/500500938107/startup-config HTTP/1.1" 200 145
178.32.46.58 - - [14/Mar/2019 13:53:55] "GET /meta/nodes/500500938107/startup-config HTTP/1.1" 200 65

Thursday, February 28, 2019

How to add NX-OS image to EVE-NG




1)make it a sataa.qcow2 image
2)after first boot configure "boot nxos bootflash:///nxos.7.0.3.I7.3.bin" and write mem

Remark: when you get into the loader type "boot nxos.7.0.3.I7.3.bin". It may be that you get again in to loader-prompt. Do again "boot nxos.7.0.3.I7.3.bin"

C8000v : logging filtering with discriminator

When log in filled up with: Sep 15 11:25:51.185 UTC: %SMART_LIC-2-PLATFORM_ERROR: Smart Licensing has encountered an internal software error...