Thursday, January 19, 2017

Frequently used commands on ASA/windows/Linux

To check which all adapter are up?
sudo -i
sudo mii-tool

To make a http request from a shell?

Some linux commands.
sudo -s : open a root shell
apt-get update : refresh available updates
apt-get upgrade : upgrade all pkgs
apt-get install pkg : install pkg
ifconfig : show network information
iwconfig : show wireless information
sudo /etc/init.d/networking restart : reset network for manual configuration
file /etc/network/interfaces : manual configuration
ifup interface : bring interface online
if down interface : disable interface
ufw enable : turn on fw
ufw disable : turn off fw
ufw default allow : allow all connection by default
ufw default deny : drop all connection by default
ufw status : current status and rules
ufw allow port : allow traffic on port
ufw deny from ip : block ip address
uname -a : get all kernel information

How to configure multiple ip address on same NIC on ubuntu?
ifconfig eth1.11 up

How to find your router’s ip address ?
NAWLEKHA-M-Q1GZ:~ nawrajlekhak$ route -n get
   route to:
  interface: en0
 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0  414008394        48        51         0      1500         0
How to check DNS server used ?
NAWLEKHA-M-Q1GZ:~ nawrajlekhak$ nslookup

How to open site from terminal?
NAWLEKHA-M-Q1GZ:Applications nawrajlekhak$ open -a firefox -g
open -a firefox -g $HOME

To find path of an application on mac ?
NAWLEKHA-M-Q1GZ:Applications nawrajlekhak$ find / -name 2>/dev/null

To replace spaces in vi as peer your need?
Need 8 leading spaces between lines 310 to 320
:310,320 s/^\s*/        /g

How to check Event Viewer logs on windows for RA client?
Right click on computer -> Manage -> system tools -> Event viewer -> windows logs -> Application
check for Ras Client which is VPN client.

How to convert ipv4 to ipv6 ?
convert ipv4 to ipv6 to 60:1:1::10/96

How to create alias on ASA?
ASA# show run all command-alias
command-alias exec h help
command-alias exec lo logout
command-alias exec p ping
command-alias exec s show

How to configure mac-address on ASA?
int g0/0
mac-address aaaa.1111.333a

To check all vlans configured on switch
Switch#show run vlan

How to check routes on Linux ?
[[email protected] ~]# route -n

How to add ipv4 route in Linux ?
route add -net netmask gw

How to reload IOS router ?
boot system disk0:/Image

reload save-config no-confirm

Two ways to execute scripts
1. sh == run time execution, no need for permission to execute
2. ./ absolute path way of execution, need permission to execute

How to turn web server on routers on that we can telnet them.
R#ip http server
line vty 0 4
no login

how to configure ip address in linux ?
sudo ifconfig ens33 netmask

How to configure ip address in windows using CLI?
netsh interface ipv4 show config
netsh interface ipv4 set address name="YOUR INTERFACE NAME" static IP_ADDRESS SUBNET_MASK GATEWAY
netsh interface ipv4 set address name=“xxxxx” static

how to do repeated ping from windows ?
ping -t

How to configure ipv6 address  in windows from cmd ?
netsh interface ipv6 add address "Local Area Connection" 2001:db8:290c:1291::1

How to configure ipv6 address  in Ubuntu /Linux?
/sbin/ip -6 addr add 2001:0db8:0:f101::1/64 dev eth1

How to add static route on Linux host ubuntu ?
route add -net netmask gw dev eth0

To ping ipv6 address

How to disable firewall on Linux ubuntu ?
to install ufw
apt-get install ufw
sudo ufw disable
sudo ufw enable : for enable
to check status : sudo ufw status

How to delete route ?
# /sbin/ip -6 route del default via 2001:0db8:0:f101::1

How to add route in win host?
go to start -> Run command line as administrator - >
route add mask

To add route persistently :
route add mask -p

How to connect to website through port using ipv4 and ipv6?