Friday, September 11, 2015

# Network Configuration
IPv4 = 32bit
Mack address =48 bit
Ifconfig = to check network address
Inet address ---- 192.168.0.250
Local lookup ------ 127.0.0.1
Ifdown eth0 ---- use to disabled a Lan
Ifup eth0 -------use to enable a Lan
Subnet mask ---24 bit
4 method setup to network:-
  • Setup ---cmd
  • System-config-network
  • Vim /etc/sysconfig/network –scripts/ifcfg-eth0
  • Manually edit network setup
Device – eth0
Bootproto—none
IPADDR = 192.168.5.1
Netmask =255.255.255.0
Onboot =yes
HWADDR=52:54:00:00:FA
Note:- ( This is a minimum entry for network configuration )
# = it is use for comments.
Hostname = to check name of host to the machine .
Vim /etc/hosts = manual entry to the host or we can check configuration of the host through them.
Vim /etc/sysconfig/network = to check our network & hostname of the machine.
# DNS = it’s stands Domain name server .it’s used to communicate IP & name . & it’s port is 53.
  • It’s resolve name to IP ADDRESS & IP ADDRESS to name .
  • Vim /etc/resolve.conf…= to check a DNS name server .
  • Dig -x 192.168.0.250 = to check in details of DNS.




# shell
Note:- shell is the command line interpreter in between a user & operating system.
Bash= born against shell
Cat /etc/shells…. You can check different shells from this command ,like that.
/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh


  • Echo $* = All arguments
  • Echo $1 = 1st arguments
  • Echo $2 = 2nd arguments
  • Echo $# = Total no. of arguments


Chmod a+x (file name) = this command used to execute a programms
  • Writing a scripts with conditional statement.
Open vim with file name














#! /bin/bash
If [ $# -ne 1 ] ; then
echo “empty argument”
elif [ $1 = “foo” ] ; then
echo “bar”
elif [ $1 = “bar” ] ; then
echo “foo”
else
echo “wrong argument”
fi
(-ne = mean not equal to operator)
# Conditional Operators
  • > = gt (greater than)
  • < = lt (less than)
  • > = = ge ( greater equal to)
  • <= = le (less than equal to)
  • ! = = ne ( not equal to)


#Logical Operator
-a = and
-o = or
$ = value of variables
Echo = a read





No comments:

Post a Comment

Linux Tables: Block All Incoming Traffic But Allow SSH

  This is very common scenario. You want to permit access to a remote machine only by SSH. You would like to block all incoming traffic to y...