Pages

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?
wget

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 60.1.1.11/24 up

How to find your router’s ip address ?
NAWLEKHA-M-Q1GZ:~ nawrajlekhak$ route -n get google.com
   route to: 216.58.197.46
destination: 216.58.197.46
    gateway: 192.168.0.1
  interface: en0
      flags:
 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 google.com
Server: 192.168.0.1
Address: 192.168.0.1#53

How to open site from terminal?
NAWLEKHA-M-Q1GZ:Applications nawrajlekhak$ open -a firefox -g http://news.google.com
open -a firefox -g $HOME

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

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
60.1.1.10/24 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 ?
[root@iLnxRTR3 ~]# route -n

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

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

or
reload save-config no-confirm

Two ways to execute scripts
1. sh name.sh == run time execution, no need for permission to execute
2. ./name.sh 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
end

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

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 60.1.1.15 255.255.255.0 60.1.1.1

how to do repeated ping from windows ?
ping 90.1.1.10 -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 10.10.10.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth0

To ping ipv6 address
ping6  

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 160.1.1.0 mask 255.255.255.0 180.1.1.10

To add route persistently :
route add 160.1.1.0 mask 255.255.255.0 180.1.1.10 -p

How to connect to website through port using ipv4 and ipv6?
http://180.1.1.10:90
http://[2001:db8:90::2]:90/