Saturday, August 13, 2016

NETWORKING - LINUX


CHECK NETWORK HARDWARE


[root@Tusharjahdav ~]# lspci -vvv | grep -i eth
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
---------------------------------------------------------------------------------------------------------------------
[root@Tusharjahdav ~]# lspci –n  ------check Hardware PCI ID’s

00:00.0 0600: 8086:7190 (rev 01)
00:0f.0 0300: 15ad:0405
02:01.0 0200: 8086:100f (rev 01) ----------LAN CARD
02:02.0 0401: 1274:1371 (rev 02)
---------------------------------------------------------------------------------------------------------------------
 What is 600, 400, 300 PCI ID’s
---------------------------------------------------------------------------------------------------------------------
How to update PCI ID

[root@Tusharjahdav ~]# yum update pciids --------------update pci ids
---------------------------------------------------------------------------------------------------------------------
How to check installed Lan Card Driver

[root@Tusharjahdav ~]# dmesg | grep -i eth  -------check Lan card drivers
R8189  --------------------driver name and extension is .ko
---------------------------------------------------------------------------------------------------------------------
How to find driver location

[root@Tusharjahdav modules]# tree | grep -i eth----find driver path( go to the /lib/module)

    │   │   │   ├── ethoc.ko
    │   │   │   ├── forcedeth.ko
    │   │   │   │   ├── cdc_ether.ko
    │   │   │   │   ├── kaweth.ko
    │   │   │   ├── veth.ko

[root@Tusharjahdav modules]# tree | grep -i ip
    │   │   │   ├── mtip32xx
    │   │   │   │   └── mtip32xx.ko
    │   │   │   ├── ipmi
    │   │   │   │   ├── ipmi_devintf.ko
    │   │   │   │   ├── ipmi_poweroff.ko
    │   │   │   │   └── ipmi_watchdog.ko
    │   │   │   │   └── ipwireless
    │   │   │   │       └── ipwireless.ko
    │   │   │   ├── chips
    │   │   │   │   ├── ipath
    │   │   │   │   │   └── ib_ipath.ko
    │   │   │       ├── ipoib


---------------------------------------------------------------------------------------------------------------------

[root@Tusharjahdav modules]# tree | grep -i .ko  -----check all driver

[root@Tusharjahdav modules]# tree | grep –i r8169 ----check lan card drivers and Path           

[root@Tusharjahdav modules]# tree | grep –i

[root@Tusharjahdav modules]# tree | grep -i .ko | wc –l   -------Total count of installed drivers
2006  ------------------------------------------------------------installed drivers

---------------------------------------------------------------------------------------------------------------------
KLM -----LKM | MONOLITHIC | MODULOR
---------------------------------------------------------------------------------------------------------------------

Ethernet alias name – eth0   /  eth1  /  (Driver Name )

mii tool used for LAN cable connection

[root@Tusharjahdav modules]# mii-tool -v eth0   ----check media cable connection
eth0: negotiated 100baseTx-FD, link ok
  product info: vendor 00:50:43, model 2 rev 3
  basic mode:   autonegotiation enabled
  basic status: autonegotiation complete, link ok
  capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
  advertising:  100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
  link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
---------------------------------------------------------------------------------------------------------------------
[root@Tusharjahdav modules]# mii-tool    ( help | flags)
No interface specified
usage: mii-tool [-VvRrwl] [-A media,... | -F media] <interface> ...
       -V, --version               display version information
       -v, --verbose               more verbose output
       -R, --reset                 reset MII to poweron state
       -r, --restart               restart autonegotiation
       -w, --watch                 monitor for link status changes
       -l, --log                   with -w, write events to syslog
       -A, --advertise=media,...   advertise only specified media
       -F, --force=media           force specified media technology
media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,
       (to advertise both HD and FD) 100baseTx, 10baseT
---------------------------------------------------------------------------------------------------------------------
[root@Tusharjahdav ~]# ethtool –h   -------help
ethtool version 3.5
ethtool -s|--change DEVNAME     Change generic options
                [ speed %d ]
                [ duplex half|full ]
                [ port tp|aui|bnc|mii|fibre ]
                [ autoneg on|off ]
                [ advertise %x ]
                [ phyad %d ]
                [ xcvr internal|external ]
                [ wol p|u|m|b|a|g|s|d... ]
                [ sopass %x:%x:%x:%x:%x:%x ]
                [ msglvl %d | msglvl type on|off ... ]
---------------------------------------------------------------------------------------------------------------------
How to check Ethernet properties

[root@Tusharjahdav ~]# ethtool eth0   ----to get the properties of eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes
---------------------------------------------------------------------------------------------------------------------
[root@Tusharjahdav ~]# ethtool -p eth0   -----to check Lan port (after this command lan port link blinking fast for 5 seconds and we can identify the port easily )
---------------------------------------------------------------------------------------------------------------------
[root@Tusharjahdav ~]# ifconfig –a  ----------------To check all the interface of lan

eth0      Link encap:Ethernet  HWaddr 00:0C:29:EC:46:4E
          inet addr:192.168.5.159  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feec:464e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5779780 errors:0 dropped:0 overruns:0 frame:0
          TX packets:122502 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1171990553 (1.0 GiB)  TX bytes:85676256 (81.7 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:153 errors:0 dropped:0 overruns:0 frame:0
          TX packets:153 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9358 (9.1 KiB)  TX bytes:9358 (9.1 KiB)
---------------------------------------------------------------------------------------------------------------------
HOW TO CONFIGURE IP IN LINUX

[root@Tusharjahdav ~]# ifconfig eth0 192.168.5.160 netmask 255.255.255.0  ---IP ADD but temparory
---------------------------------------------------------------------------------------------------------------------
HOW TO PERMENT IP IN LINUX

[root@Tusharjahdav ~]# cd /etc/sysconfig/network-scripts/  ----go to network-scripts dir
[root@Tusharjahdav network-scripts]# ls
ifcfg-eth0  ifdown-bnep  ifdown-ipv6  ifdown-ppp     ifdown-tunnel  ifup-bnep  ifup-ipv6  ifup-plusb  ifup-routes  ifup-wireless     network-functions
ifcfg-lo    ifdown-eth   ifdown-isdn  ifdown-routes  ifup           ifup-eth   ifup-isdn  ifup-post   ifup-sit     init.ipv6-global  network-functions-ipv6
ifdown      ifdown-ippp  ifdown-post  ifdown-sit     ifup-aliases   ifup-ippp  ifup-plip  ifup-ppp    ifup-tunnel  net.hotplug

ETH0 IP ADD STORE in  ifcfg-eth0  FILE  ----------for ip persistence files

[root@Tusharjahdav network-scripts]# vi ifcfg-eth0 -Add IP for permeant(ip configure file )

DEVICE="eth0” ----------------Ethernet port
ONBOOT=yes -----------------------always yes
BOOTPROTO=none ----------------- (used for STATIC and DHFP)
UUID="1ec719ef-f110-4d98-943b-e36486a4f38a"
HWADDR=00:0C:29:EC:46:4E ---------------------------MAC ADD
IPADDR=192.168.5.160   ----------------------------------IP ADD
NETMASK=255.255.255.0 --------------------------------SUBNET
GATEWAY=192.168.5.1 -------------------------------GW

wq!------save
---------------------------------------------------------------------------------------------------------------------
HOW TAKE BAKCUP OF ETH0 / NETWORK FILE

[root@Tusharjahdav network-scripts]# cp ifcfg-eth0 eth0-ifcfg.bak

[root@Tusharjahdav network-scripts]# ls

eth0-ifcfg.bak -----Backup File
ifcfg-eth0   ----------eth0 original file
---------------------------------------------------------------------------------------------------------------------

[root@Tusharjahdav ~]# service network restart   --- Restart all Interface

[root@Tusharjahdav ~]# ifconfig eth0 down   -------Single Port Down

 [root@Tusharjahdav ~]# ifconfig eth0 up    -------Single Port UP

[root@Tusharjahdav ~]# ifup eht0

[root@Tusharjahdav ~]# ifdown eht0

---------------------------------------------------------------------------------------------------------------------

HOW TO CONFIGURE IP ADD PERMENT IN LINUX

[root@Tusharjahdav ~]# neat – tui

[root@Tusharjahdav ~]# netconfig

[root@Tusharjahdav ~]# setup   ----Configure with Graphic Mode





[root@Localhost ~]# system-config- tab tab----   used for Graphics mode

system-config-authentication     system-config-firewall        system-config-keyboard            system-config-network-cmd       system-config-users             system-config-date                          system-config-firewall-tui          system-config-network         system-config-network-tui

[root@Tusharjahdav ~]# system-config-network-tui   ----Configure with Graphic Mode



---------------------------------------------------------------------------------------------------------------------
IP Aliasing --à IP Additional Configure

Linux Standard –63 IP Assign to single LAN port & depends upon Lan Card
---------------------------------------------------------------------------------------------------------------------
HOW TO ASSIGN MULTIPLE IP’S  TO SINGLE LAN PORT

[root@Tusharjahdav ~]# ifconfig eth0:0 192.168.5.50 netmask 255.255.255.0

[root@Tusharjahdav ~]# ifconfig eth0:1 192.168.4.150 netmask 255.255.255.0

[root@Tusharjahdav ~]# ifconfig eth0:2 192.168.7.190 netmask 255.255.255.0

Above commands for temporary

[root@Tusharjahdav ~]# ping 192.168.5.50

PING 192.168.5.50 (192.168.5.50) 56(84) bytes of data.
64 bytes from 192.168.5.50: icmp_seq=1 ttl=64 time=0.082 ms
64 bytes from 192.168.5.50: icmp_seq=2 ttl=64 time=0.050 ms
64 bytes from 192.168.5.50: icmp_seq=1 ttl=64 time=0.042 ms
64 bytes from 192.168.5.50: icmp_seq=2 ttl=64 time=0.049 ms
64 bytes from 192.168.5.50: icmp_seq=3 ttl=64 time=0.047 ms

[root@Tusharjahdav ~]# ping 192.168.4.190

PING 192.168.4.190 (192.168.4.190) 56(84) bytes of data.
64 bytes from 192.168.4.190: icmp_seq=1 ttl=64 time=0.060 ms
64 bytes from 192.168.4.190: icmp_seq=2 ttl=64 time=0.049 ms
64 bytes from 192.168.4.190: icmp_seq=3 ttl=64 time=0.051 ms
64 bytes from 192.168.4.190: icmp_seq=4 ttl=64 time=0.050 ms
64 bytes from 192.168.4.190: icmp_seq=5 ttl=64 time=0.051 ms


[root@Tusharjahdav ~]# ifconfig –a   -----OUT PUT

eth0      Link encap:Ethernet  HWaddr 00:0C:29:EC:46:4E
          inet addr:192.168.5.159  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:feec:464e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5822412 errors:0 dropped:0 overruns:0 frame:0
          TX packets:127144 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1184719105 (1.1 GiB)  TX bytes:86150544 (82.1 MiB)

eth0:0    Link encap:Ethernet  HWaddr 00:0C:29:EC:46:4E
          inet addr:192.168.5.50  Bcast:192.168.5.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:EC:46:4E
          inet addr:192.168.4.190  Bcast:192.168.4.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:165 errors:0 dropped:0 overruns:0 frame:0
          TX packets:165 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:10174 (9.9 KiB)  TX bytes:10174 (9.9 KiB)

Eth0 ---------- Stand for Interface
IP -------------Stand for Identify
MAC --------Stand for transfer data
RX ----------Stand for Receiving the data
TX ---------- Stand for transfer the data         

lo -------------Stand for loop bank add (Virtual Interface )
user/app use this interface for testing purpose

Sito -----IP4 & IP6 Turning

---------------------------------------------------------------------------------------------------------------------
  [root@Localhost ~]# ip-----------------------ip Synopsis

Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
       ip [ -force ] -batch filename
where  OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable |
                   tunnel | maddr | mroute | mrule | monitor | xfrm | token }
       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
                    -f[amily] { inet | inet6 | ipx | dnet | link } |
                    -o[neline] | -t[imestamp] | -b[atch] [filename] |
                    -rc[vbuf] [size]}
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# ip l

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:ec:46:4e brd ff:ff:ff:ff:ff:ff
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# ip addr show  ------check ip, mac and card details

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:ec:46:4e brd ff:ff:ff:ff:ff:ff
    inet 192.168.5.159/24 brd 192.168.5.255 scope global eth0
    inet6 fe80::20c:29ff:feec:464e/64 scope link
       valid_lft forever preferred_lft forever
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# ip a  ------check ip, mac and card details

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:ec:46:4e brd ff:ff:ff:ff:ff:ff
    inet 192.168.5.159/24 brd 192.168.5.255 scope global eth0
    inet6 fe80::20c:29ff:feec:464e/64 scope link
       valid_lft forever preferred_lft forever
---------------------------------------------------------------------------------------------------------------------
[root@localhost root]# ip r ------check Lan status
                                                  
192.168.7.0/24 dev eth0  proto kernel  scope link  src 192.168.7.50
192.168.5.0/24 dev eth0  scope link
169.254.0.0/16 dev eth0  scope link
127.0.0.0/8 dev lo  scope link
default via 192.168.5.254 dev eth0
  ---------------------------------------------------------------------------------------------------------------------

HOW TO CONFIGURE GATEWAY

We can configure Default GATEWAY only one in single system and configure multiple GETWAY in single system.

[root@Localhost ~]# route –n  ------check route and Gateway
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.5.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# route add default gw 192.168.5.1  ------Gateway add

[root@Localhost ~]# route –n ------to check Gateway
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.5.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
0.0.0.0         192.168.5.1     0.0.0.0               UG    0      0        0 eth0

[root@Localhost ~]# route add default gw 192.168.4.1  --I will try 2 Getway in single system
SIOCADDRT: No such process ------------------not accept 2 GETWAY
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# route del default gw 192.168.5.1  -------Delete GATEWAY

[root@Localhost ~]# route –n  -------------------to check
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.5.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
---------------------------------------------------------------------------------------------------------------------
HOW TO PERSISTENT OF GATEWAY

[root@Localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0  ----Add gateway entry.

[root@Localhost ~]# vi /etc/sysconfig/network   -------  change hostname

[root@Localhost ~]# service network restart   -----restart network

[root@Localhost ~]# route –n  -------------------to check
---------------------------------------------------------------------------------------------------------------------

[root@Localhost ~]# ping -I eth0 192.168.5.15  ------send packets to specific netwaork
PING 192.168.5.15 (192.168.5.15) from 192.168.5.159 eth0: 56(84) bytes of data.
64 bytes from 192.168.5.15: icmp_seq=1 ttl=64 time=1.44 ms
64 bytes from 192.168.5.15: icmp_seq=2 ttl=64 time=0.227 ms
64 bytes from 192.168.5.15: icmp_seq=3 ttl=64 time=0.208 ms
64 bytes from 192.168.5.15: icmp_seq=4 ttl=64 time=0.197 ms
64 bytes from 192.168.5.15: icmp_seq=5 ttl=64 time=0.197 ms
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# ping

Usage: ping [-LRUbdfnqrvVaA] [-c count] [-i interval] [-w deadline]
            [-p pattern] [-s packetsize] [-t ttl] [-I interface or address]
            [-M mtu discovery hint] [-S sndbuf]
            [ -T timestamp option ] [ -Q tos ] [hop1 ...] destination

  
 [root@Localhost ~]# ping -c 10 -s 1024 192.168.5.15   ----ping 5.15 IP and send 1024 packages & c for count (stop after 10 line)

PING 192.168.5.15 (192.168.5.15) 1024(1052) bytes of data.
1032 bytes from 192.168.5.15: icmp_seq=1 ttl=64 time=0.602 ms
1032 bytes from 192.168.5.15: icmp_seq=2 ttl=64 time=0.220 ms
1032 bytes from 192.168.5.15: icmp_seq=3 ttl=64 time=0.232 ms
1032 bytes from 192.168.5.15: icmp_seq=4 ttl=64 time=0.269 ms
1032 bytes from 192.168.5.15: icmp_seq=5 ttl=64 time=0.206 ms
1032 bytes from 192.168.5.15: icmp_seq=6 ttl=64 time=0.196 ms
1032 bytes from 192.168.5.15: icmp_seq=7 ttl=64 time=0.230 ms
1032 bytes from 192.168.5.15: icmp_seq=8 ttl=64 time=0.211 ms
1032 bytes from 192.168.5.15: icmp_seq=9 ttl=64 time=0.224 ms
1032 bytes from 192.168.5.15: icmp_seq=10 ttl=64 time=0.187 ms
---------------------------------------------------------------------------------------------------------------------
Icmp  ----internet control messaging protocols  ( for testing the reachability )
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# traceroute google.com 
traceroute to google.com (216.58.220.14), 30 hops max, 60 byte packets
 1  122.15.105.49 (122.15.105.49)  19.963 ms  19.593 ms  19.489 ms
 2  182.19.106.198 (182.19.106.198)  19.334 ms  19.258 ms  19.410 ms
 3  103.29.44.7 (103.29.44.7)  19.799 ms  19.232 ms  19.126 ms
 4  103.29.44.4 (103.29.44.4)  19.519 ms  19.399 ms  19.313 ms
 5  72.14.211.218 (72.14.211.218)  19.278 ms  19.112 ms  19.192 ms
 6  72.14.236.136 (72.14.236.136)  20.785 ms  8.664 ms  8.478 ms
 7  74.125.37.235 (74.125.37.235)  10.619 ms  9.758 ms  10.416 ms
 8  bom05s05-in-f14.1e100.net (216.58.220.14)  13.045 ms  12.795 ms  12.768 ms
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# mtr google.com
                                                                        My traceroute  [v0.75]
Localhost.localdomain (0.0.0.0)                                                                                                                Fri Jan 22 03:27:05 2016
Resolver: Received error response 2. (server failure)er of fields   quit
  Packets                       Pings                           
  Host                                                      Loss%   Snt   Last      Avg   Best  Wrst StDev
 1. 122.15.105.49                                         14.0%    93    8.7        17.4   4.1    58.9  14.3
 2. 182.19.106.198                                        8.6%     93   17.7      18.2    4.3   73.8  15.0
 3. 103.29.44.7                                              98.9%    93    4.8      4.8     4.8     4.8   0.0
 4. 103.29.44.4                                              8.6%     93    11.5     20.0   4.3    90.4  19.6
 5. 72.14.211.218                                          15.1%    93    9.5      24.9   5.0    83.3  20.9
 6. 72.14.236.136                                          14.0%    93   11.8     19.8   5.3    77.0  18.1
 7. 74.125.37.235                                           3.2%    93    19.9     21.5   5.4    92.9  19.9
 8. bom05s05-in-f14.1e100.net                      7.5%    93    8.3     18.7    5.1    94.1  16.8
---------------------------------------------------------------------------------------------------------------------
PACKET SNIFFER TOOLS            ||||||      PACKET CAPTURE TOOLS
---------------------------------------------------------------------------------------------------------------------

[root@Localhost ~]# ethtool eth0   -----------Deprecate (OLDER)

[root@Localhost ~]# tcpdump  ------------|   To check broadcast

[root@Localhost ~]# tcpdump –vvv  ------|  To check broadcast

 [root@Localhost ~]# tcpdump -vvv >/opt/tcpfile  -----Packets copy to tcpfiles to /opt/ folder
                                                                                         (sniffer | capture tools)
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes

[root@Localhost opt]# less tcpfile  -----check dump file
[root@Localhost opt]# cat tcpfile   -----check dump file

iptraf
wireshark ---------rpm
---------------------------------------------------------------------------------------------------------------------
PORT  --Protocols -----Set of rules

HTTP –Web  |   FTP – Data Transfer | SSH  - Remote  |  SMTP – Mail  | DHCP –Assign IP

Port help to connect application & Protocols.
Port on associated with protocols.

[root@Localhost ~]# less /etc/services  -----to get the all port details

tcpmux          1/tcp                           # TCP port service multiplexer
echo            7/udp
ftp-data        20/tcp
ftp             21/udp          fsp fspd # 21 is registered to ftp, but also used by fsp
ssh             22/tcp                          # The Secure Shell (SSH) Protocol
telnet          23/udp
lmtp            24/tcp                          # LMTP Mail Delivery # 24 - private mail system
smtp            25/tcp          mail
tacacs          49/tcp                          # Login Host Protocol (TACACS)
re-mail-ck      50/tcp                          # Remote Mail Checking Protocol
domain          53/tcp       DNS                 # name-domain server
bootps          67/tcp           DHCP               # BOOTP server
bootpc          68/tcp          DHCP             # BOOTP client
tftp            69/udp            DHCP
http            80/tcp          www www-http    # WorldWideWeb HTTP
rtelnet         107/tcp                         # Remote Telnet
pop3            110/tcp         pop-3           # POP version 3
sunrpc          111/tcp         portmapper rpcbind      # RPC 4.0 portmapper TCP
auth            113/tcp         authentication tap ident
rdesktop       3389
ntp             123/udp                         # Network Time Protocol
samba      137/139/445                        # NETBIOS Datagram Service
imap            143/tcp         imap2           # Interim Mail Access Proto v2
https           443/tcp                         # http protocol over TLS/SSL
rsync           873/tcp                         # rsync
rquotad         875/tcp                         # rquota daemon
telnets         992/tcp
imaps           993/tcp                         # IMAP over SSL
pop3s           995/udp                         # POP-3 over SSL
MYSQL      3306
Idap             389
Nfs              2049
---------------------------------------------------------------------------------------------------------------------

How to check port status on own system (Local Machin)

[root@Localhost ~]# nmap 127.0.0.1   -----local system to test port

Starting Nmap 5.51 ( http://nmap.org ) at 2016-01-22 04:10 PST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000010s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
25/tcp open  smtp
Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# nmap localhost   -----local system to test port

Starting Nmap 5.51 ( http://nmap.org ) at 2016-01-22 04:10 PST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000070s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
25/tcp open  smtp
Nmap done: 1 IP address (1 host up) scanned in 0.07 seconds
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# ip r l  -----check IP , GW, Subnet details
192.168.7.0/24 via 192.168.5.1 dev eth0  ---------------------------------------------- --GW -NW
192.168.5.0/24 dev eth0  proto kernel  scope link  src 192.168.5.159  metric 1  ------NW - IP
default via 192.168.5.1 dev eth0  proto static  ----------------------------------------------GW

---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# nmap -v -sn 192.168.4.0/24  ----check all network ips details
[root@Localhost ~]# nmap 192.168.5.0/24
[root@Localhost ~]# nmap 192.168.5.0/255.255.255.0
---------------------------------------------------------------------------------------------------------------------

HOW TO OPEN PORT IN LOCAL MACHIN (SERVER SYSTEM)

[root@Localhost ~]# namap localhost
[root@Localhost ~]# service httpd start --------open 80 port
[root@Localhost ~]# service vsftp start --------open 21/20 port

HOW TO CHECK PORT STATUS
[root@Localhost ~]# telnet 127.0.0.1 22 -----check 22 port
[root@Localhost ~]# nc 127.0.0.1 22 – net cat  -------carser is blick means port open
[root@Localhost ~]# nc 127.0.0.1 80 ----------check 80 port status on local system
[root@Localhost ~]# nc 127.0.0.1 net cat
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]#  nc …..chatting…..----remote display
[root@Localhost ~]# netstat ----------Listen | Established
[root@Localhost ~]# netstat –an
[root@Localhost ~]# netstat –tulnp
[root@Localhost ~]# netstat –vatnp
[root@Localhost ~]# netshat –tulnp | grep –I ssh
 ---------------------------------------------------------------------------------------------------------------------
  
HOW TO SET | CHANGE HOSTNAME

[root@Localhost ~]# hostname
Localhost.locathost  -----------------------------------host name
[root@Localhost ~]# hostname champu.example.com ----this command for temparory.
[root@Localhost ~]# cat /proc/sys/kernel/hostname ------temp
[root@Localhost ~]# vi /etc/sysconfig/network -------add host name in this file
Hostname=champu.example.com 

[root@Localhost ~]#vi /etc/hosts  -----flat DNS  example
192.168.1.X   champu.example.com  champu  ---for resolved ip to name and name to ip
       1                           2                          3
---------------------------------------------------------------------------------------------------------------------
( DNS ----called ---Bind )
---------------------------------------------------------------------------------------------------------------------
PING CHECK

1)  /etc/hosts
2)  /etc/resolv.conf
---------------------------------------------------------------------------------------------------------------------
HTTP://
FTP://
---------------------------------------------------------------------------------------------------------------------
[root@Localhost ~]# ls /etc/resolv.conf  ------File contain DNS Server Informations

[root@Localhost ~]# vi /etc/resolv.conf -------add dns name

nameserver 203.12.10.201  ]
nameserver 203.12.10.202  ]    ISP IP
nameserver 8.8.8.8   ]
nameserver 4.2.2.2   ]   Global DNS
---------------------------------------------------------------------------------------------------------------------


No comments:

Post a Comment