Showing posts with label juniper. Show all posts
Showing posts with label juniper. Show all posts

Monday, 22 May 2017

source NAT on juniper SSG

I wanted to source NAT my traffic so it appears to come from 10.58.x.x range so it could go over my VPN.

I was able to do this with a DIP on juniper. The DIP must be created on the tunnel interface which is attached to the VPN that we want to travel over.


Since the tunnel interface is unnumbered I confgured the extended IP
10.58.254.1 /24 (I know this range is free)
For the DIP range I gave 10.58.254.2 - 10.58.254.254

set interface tunnel.4 ext ip 10.58.254.1 255.255.255.0 dip 4 10.58.254.2 10.58.254.254

You need a policy to allow the traffic and do the NAT.
The policy should be at the top so other rules won't overlap/interfere.

set policy id 123 from "Trust" to "Untrust" "LOCAL_NETS_2_NAT" "REMOVE_VPN_NETS" "ANY" nat src dip-id 4 permit log

The 10.58.x.x/16 network already had a policy to allow the traffic and was already in the encryption domain.

Did a debug flow basic and it seems to have worked, will test now.

WebGUI
Network -> Interfaces -> Edit tunnel.4
DIP tab  -> New 
Fill in IP range 10.58.254.2 - 10.58.254.254
Select port translation
Select in the same subnet as the extended IP fill in 10.58.254.1/24

Create you NAT policy
Policy -> Policies
Select source and destination networks
Service = ANY
Action = Permit
Click Advanced button
Tick Source Translation
Select the DIP you created on tun.4 
Click ok


Thursday, 5 November 2015

packet-tracer for juniper screen os ... sort of

http://kb.juniper.net/InfoCenter/index?page=content&id=KB5536&actp=search

Set logging the debug to the console (not sure that this is required might be an old command)
set console dbuf

Set your filters to match the interesting traffic
set ffilter src-ip xx.xx.xx.xx dst-ip yy.yy.yy.yy
set ffilter src-ip yy.yy.yy.yy dst-ip xx.xx.xx.xx

unset ffilter ? (to remove, usually use id "0")

Start the debug
Debug flow basic
(can also use 'debug flow drop' to only see drop/deny)

Generate your traffic
ping yy.yy.yy.yy

Stop the debug
Press ESC when finished or 'undebug all'

Show the debug output
get db stream

Clear the debug to do a fresh test without a wall of text
clear db

There is a lot of output but if you read through you should see the routing, nat and policy(ACL) matching and what happened to the traffic.





Thursday, 7 March 2013

Issues connecting a VPN between Juniper SSG and Sonicwall

I was trying to connect a VPN between a Juniper SSG and Sonicwall firewall.

Phase 1 came up ok but I kept getting this message:
Received a notification message for DOI 0 18 INVALID-ID-INFORMATION.

Juniper support says this usually means there is a mismatch in the proxy id or the phase 2 proposal. I confirmed with screenshots that both matched on the other side. I logged a call with Juniper and found we needed to set a further option "Local ID". This was because my Juniper is behind a NAT. It is behind another firewall. We need to fill in the local ID with the public IP address of the Juniper. This was strange because I have other VPNs with other vendors (Cisco/Juniper) and this option is not filled in yet the VPNs work. It may be a specific issue related to Juniper <-> Sonicwall VPNs.

GUI
The setting can be found under VPNs -> AutoKey Advanced -> Gateway
Edit the gateway that is having the issue -> Advanced -> Local ID
Fill in the Public IP address of YOUR firewall

CLI
set ike gateway "GWName-12-34-56-789" address 12.34.56.789 Main local-id "200.100.100.100" outgoing-interface "ethernet0/2" preshare "*********" proposal "pre-g2-3des-sha-86400"


Tuesday, 22 January 2013

How to check if a juniper ssg is in a cluster

This SSG is in a cluster

MYSSG-> get nsrp
nsrp version: 2.0
cluster info:
cluster id: 1, name: SSG_CLUSTER
local unit id: xxxxxxxx
active units discovered:
index: 0, unit id:   xxxxxxx, ctrl mac: xxxxxxxxxxxx , data mac: xxxxxxxxxxxx
index: 1, unit id:    xxxxxxx, ctrl mac: yyyyyyyyyyy , data mac: yyyyyyyyy

total number of units: 2

This SSG is not

OtherSSG-> get nsrp
nsrp version: 2.0
cluster info:
 cluster id not set: nsrp is inactive



Collecting logs from a juniper ssg firewall

Turn on logging in putty

set console page 0

get tech

set console page 22

If trouble shooting a VPN

set console page 0

get tech
get ike cookie
get sa
get route
get event include x.x.x.x (peer address)
get event type 536

set console page 22

Thursday, 9 August 2012

tracking high bandwidth usage within a network

The best way to trace where traffic is coming from / going to is to use something like netflow which will cost money at least for someones time to implement. Another approach is to graph all interfaces of router/firewalls/switches/servers with MRTG, Cacti or similar. Look at the interfaces and attempt to trace the traffic that way. Otherwise it can be difficult and you can only investigate while the traffic is happening.

On the the Cisco ASA firewalls these commands can help

If mem and CPU are not high then its probably not a DDOS attack
show cpu
show memory (lots of connections use memory, how much does your device normally use)
show xlate count (to see number of translations a high number like XXXXX would be there during an attack)
show conn count (every connection creates a conn entry in memory to enable stateful inspection)
show traffic (will show which interface has more traffic)

You can paste the output of sh conn into this and get results.
Good for finding top talkers
http://www.tunnelsup.com/cisco-asa-show-connections-analyzer/


You will need to set scroll back line\s in putty to 20000
show local-host | incl host|count|embryonic
Legend for the output
local host     :  Local IP of station in LAN
conn(s)/limit  :   number of conn entries (connections) and their possible limit for this IP
embryonic(s)/limit  :  number of embryonic (half-open) connections to this IP and their limit

Look for the host with the most connections in count/limit

show loacl-host 10.5.10.20 (for more info on that host)

Scroll through and see the IP addresses its connecting to. You can look the IP's up in something like http://mxtoolbox.com/ maybe this will give you a clue to the cause of the traffic. If you don't see the same IP appearing a lot then it could just be lots of internet traffic.

Another approach is to run the two following commands

show int | i 5 minute input rate
show int | i 5 minute output rate

Look for the highest then change the i for a b
Find the interface that has all the traffic passing through it
show int ip brief (to see a summary of the interfaces)
show int gi0/2 (to see more detail on a specific interface)sh

On Cisco switches use the following commands:
show int | i 5 minute input rate
show int | i 5 minute output rate
show int summary (show a summary of the interfaces)
show mac address-table (see what mac addresses are on what ports)
show arp (see what IP addresses are linked to mac addresses)
You can use this page to look up mac addresses (http://www.coffer.com/mac_find/)

Consider a netflow connector
https://www.manageengine.com/products/firewall/cisco-asa-netflow-log-analysis.html

Warning Netflow can tax the CPU further and cause the ASA to crash be careful

Might be worth a read
https://community.spiceworks.com/topic/144272-traffic-analysis-bandwidth-for-cisco-asa



Monday, 16 July 2012

saving the config to tftp on a juniper firewall with screenos


save config to tftp [IP_OF_TFTP_SERVER] [FILENAME_OF_CONFIG]

save config to tftp 192.168.1.10 my-firewall-cfg.rtf