Pages

Monday, December 12, 2016

Day Night Bandwidth Script for CISCO L3 Switches by Linux


Day Night Bandwidth Script for CISCO L3 Switches by Linux

Create two files, One for Day which will start from 08:30am and Another for Night which will start from 06:10PM


crontab -e
30 8 * * 0-4   /usr/bin/bandwidth/CISCO-L3-Day
10 18 * * 0-4    /usr/bin/bandwidth/CISCO-L3-Night

### Day File create CISCO-L3-Day

vi /usr/bin/bandwidth/CISCO-L3-Day
#!/bin/sh
#Day Shift User Bandwidth Limit  for 192.168.10.10 L3 Switch
( echo open 192.168.10.10
  sleep 5
  echo UserName
  sleep 5
  echo Password
  sleep 1
  echo en
  sleep 1
  echo EnablePassword
  echo "conf t"
  sleep 1


####### User-1 Name ID etc for Day in fa0/3 interface #######

echo "interface FastEthernet0/3"
sleep 1
echo "no service-policy output 21mb"
sleep 1
echo "service-policy output 7mb"
sleep 1

####### User-2 Name ID etc for Day in fa0/4 interface #######

echo "interface FastEthernet0/4"
sleep 1
echo "no service-policy output 2mb"
sleep 1
echo "service-policy output 1mb"
sleep 1


echo "exit"
sleep 1
echo "exit"

echo some more output, etc. ) | telnet

################ End of Day File ###########

### Night File create CISCO-L3-Night

vi /usr/bin/bandwidth/CISCO-L3-Night
#!/bin/sh
#Day Shift User Bandwidth Limit  for 192.168.10.10 L3 Switch
( echo open 192.168.10.10
  sleep 5
  echo UserName
  sleep 5
  echo Password
  sleep 1
  echo en
  sleep 1
  echo EnablePassword
  echo "conf t"
  sleep 1


####### User-1 Name ID etc for Night in fa0/3 interface #######

echo "interface FastEthernet0/3"
sleep 1
echo "no service-policy output 7mb"
sleep 1
echo "service-policy output 21mb"
sleep 1

####### User-2 Name ID etc for Day in fa0/4 interface #######

echo "interface FastEthernet0/4"
sleep 1
echo "no service-policy output 1mb"
sleep 1
echo "service-policy output 2mb"
sleep 1


echo "exit"
sleep 1
echo "exit"

echo some more output, etc. ) | telnet

################ End of Night File #######################################
###########################################################################
Make Sure to create  Profile of policy-map to Switch 192.168.10.10 L3 Switch

policy-map 21mb
 class traffic
    police 21504000 2000000 exceed-action drop

policy-map 7mb
 class traffic
    police 7168000 2000000 exceed-action drop

policy-map 2mb
 class traffic
    police 2048000 2000000 exceed-action drop

policy-map 1mb
 class traffic
    police 1024000 1024000 exceed-action drop

############################################# Enjoy#####################

Sunday, November 20, 2016

Secure Domain by Free SSL certificate Lets Encrypt


Let's Encrypt is a free, automated, and open certificate authority brought to you by the non-profit Internet Security Research Group (ISRG)


Thursday, November 17, 2016

Windows Folder accessing problem


Cant open windows Folder...

Error Message is like bellow
"This file does not have a program associated with it for performing this action.
Please install a program or, if one is already installed, create an association in the Defalut Programs control"


Goto ::: RUN and type "regedit" click "Yes"

HKEY_CLASSES_ROOT ->>
Directory ->> Shell ->>
Delete CMD and Find directory


...................Delete and exit.............. and try to open your folder again.... Enjoy......


Sunday, November 13, 2016

Cacti RRD file not creating


Error:: messages.

"there are no rra's assigned to local data id"
or
"RRDTool Says:
ERROR: opening '/var/ww/html/cacti/rra/sw-new_traffic_in_28.rrd': No such file or directory"

=============
Check host template

Login- to cacti web by admin -> Click "Console" => Click "Data Templates" =>

Select all "Daily", Monthly, Weekly, Yearly
Select a template "Interface- Traffic" ->  Associated RRA's
                                                               This field is always templated.  
Select all "Daily", Monthly, Weekly, Yearly
and Save.

==============

Saturday, November 5, 2016

Install DKIM SPF in CentOS

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
 rpm -ivh epel-release-6-8.noarch.rpm
 yum install dkim-milter


 vi /etc/mail/dkim-milter/dkim-filter.conf
KeyList /etc/mail/dkim-milter/keys/keylist

vi /etc/mail/dkim-milter/keys/keylist
*@tayabkhan.com:tayabkhan.com:/etc/mail/dkim/keys/tayabkhan.com/default


mkdir -p /etc/mail/dkim/keys/tayabkhan.com
cd /etc/mail/dkim/keys/tayabkhan.com
dkim-genkey -r -d tayabkhan.com
chmod 644 *
mv default.private default

cat default.txt
add those lines bottom of the zone file of tayabkhan.com
 
vi /etc/mail/dkim-milter/dkim-filter.conf
Socket inet:8892@localhost

= vi /etc/postfix/main.cf

 milter_default_action = accept
 milter_protocol = 2
 smtpd_milters = inet:localhost:8891
 non_smtpd_milters = inet:localhost:8891



/etc/init.d/dkim-milter start

chkconfig dkim-milter on
/etc/init.d/dkim-milter restart

========================
Open DKIM
==========================
yum install opendkim

cp opendkim.conf open-dkim-old

vi /etc/opendkim.conf
100 dd

AutoRestart             Yes
AutoRestartRate         10/1h
LogWhy                  Yes
Syslog                  Yes
SyslogSuccess           Yes
Mode                    sv
Canonicalization        relaxed/simple
ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts
InternalHosts           refile:/etc/opendkim/TrustedHosts
KeyTable                refile:/etc/opendkim/KeyTable
SigningTable            refile:/etc/opendkim/SigningTable
SignatureAlgorithm      rsa-sha256
Socket                  inet:8891@localhost
PidFile                 /var/run/opendkim/opendkim.pid
UMask                   022
UserID                  opendkim:opendkim
TemporaryDirectory      /var/tmp

-------------
mkdir /etc/opendkim/keys/tayabkhan.com
opendkim-genkey -D /etc/opendkim/keys/tayabkhan.com/ -d tayabkhan.com -s default
chown -R opendkim: /etc/opendkim/keys/tayabkhan.com
mv /etc/opendkim/keys/tayabkhan.com/default.private /etc/opendkim/keys/tayabkhan.com/default

vi /etc/opendkim/KeyTable
default._domainkey.tayabkhan.com tayabkhan.com:default:/etc/opendkim/keys/tayabkhan.com/default


 vi /etc/opendkim/TrustedHosts
127.0.0.1
#host.example.com
#192.168.1.0/24
tayabkhan.com
ns3.tayabkhan.com
mail.tayabkhan.com
203.190.8.0/21


cat /etc/opendkim/keys/mydomain.com/default.txt
default._domainkey IN TXT "v=DKIM1; g=*; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4pWYSQmBf5fDCwQtXAM0G3NIwMElLKHpmtCMHiWpMAttPmAgUvVYFCElWeYgpkUkb0FKTbXEVYJTKNmUMABwlVMxTOBQd8lZaI574FQf6Ch/KeONRfsMrPBkG/Vdp4IKnmseJJn65lPTDZWlr7s28GeKbCQeet2HnXh65vQWHYwIDAQAB" ; ----- Tayab khan created DKIM default for tayabkhan.com
tayabkhan.com.   TXT "v=spf1 a mx ptr -all"
And add dns zone file entry above the way.


 vi /etc/opendkim/SigningTable
*@tayabkhan.com default._domainkey.tayabkhan.com



vi /etc/postfix/main.cf

smtpd_milters           = inet:127.0.0.1:8891
non_smtpd_milters       = $smtpd_milters
milter_default_action   = accept
milter_protocol         = 2




service opendkim start
chkconfig opendkim on
service postfix restart


# Enjoy#############

Friday, November 4, 2016

MikroTik Queue Graph by Cacti


*** Cacti MRTG/Graph for MikroTik

Download Zip File and Unzip and upload specific directory

1. zipdir/scripts/mikrotik_wireless_interfaces.php -> usr/share/cacti/scripts/mikrotik_wireless_interfaces.php
2. zipdir/scripts/mikrotik_ppp_connections.php -> usr/share/cacti/scripts/mikrotik_ppp_connections.php
3. zipdir/resources/script_server/mikrotik_wireless_interfaces.xml -> usr/share/cacti/resources/script_server/mikrotik_wireless_interfaces.xml
4. zipdir/resources/snmp_queries/mikrotik_queue_simple.xml -> usr/share/cacti/resources/snmp_queries/mikrotik_queue_simple.xml
5. zipdir/resources/snmp_queries/mikrotik_queue_tree.xml -> usr/share/cacti/resources/snmp_queries/mikrotik_queue_tree.xml
6. zipdir/resources/snmp_queries/mikrotik_wireless_client.xml -> usr/share/cacti/resources/snmp_queries/mikrotik_wireless_client.xml

Finally Import Template "cacti_host_template_mikrotik.xml" from CACTI Admin Login from web




https://dl.dropboxusercontent.com/u/16618107/cacti-mikrotik-queue.rar

Saturday, October 29, 2016

FTTX solution GEPON OLT PhyHome Configuration


PhyHome OLT Configure
--------------------
default username and password: admin admin


# display running-configuration
# hostname New-OLT
** Goto System Mode
# system
** Goto System Configure Mode
system# configure
system\configure#

** Enable Uplink Ports**********
system\configure# uplink on 6:1
system\configure# uplink on 6:2
system\configure# uplink on 6:3
system\configure# uplink on 6:4
*** Set Uplink Mode to fiber or SFP/Optical etc...
**sgmii-coper port
**fiber-1G
**optical-10G
system\configure# uplink mode sgmii 6:1  //set uplink port-2 for SGMI/coper/Electrical SFP
system\configure# uplink mode fiber 6:2  //set uplink port-2 for fiber
system\configure# uplink mode sgmii 6:3 //Set uplink port-3 for coper
*** check uplink configuration: system# display uplink configuration all

*** Enable PON port*********
system\configure# pon on 1 1   //enable pon-1 for slot-1
system\configure# pon on 1 2   // slot-1 pon-2 enable
system\configure# pon on 1 3   // slot-1 pon3 enable
system\configure# pon on 1 4   // slot-1 pon4 enable

***** Configur VLAN and Tag to Uplink ***********

system\configure# exit
system# exit

// Configure maintenance VLAN and management IP // L2 VLAN Tag
system# exit
# maintenance
maintenance# config
maintenance\configure#
maintenance\configure# manage vlan 24 6:1 tagged
//management uplink port 6:1 set for vlan-id 24 and set management IP 192.168.10.2 with gateway 192168.10.1
maintenance\configure# manage ip 192.68.10.2/24
maintenance\configure# manage ip 192.68.10.2/24 192.168.10.1
#save
//Must need to create a VLAN at 192.168.10.1 device to untag this

##******* OLT Username Password Set /Reset / New User create *********
# maintenance
maintenance# configure
maintenance\configure# user add tayab tayab123
Successfully added user tayab as a NORMAL_USER ,
//To change user role use "user role" command .
maintenance\configure# user role admin tayab enablepassword
Successfully change user tayab to ADMIN mode.
maintenance\configure#
** Change Admin default password
maintenance\configure# user login-password admin
Input new login password for user admin please.
New Password:********
Confirm Password:********
Successfully changed password!.
maintenance\configure#


** Delete vlan if any error
maintenance\configure# manage vlan delete


*** SNMP and Time settings ********
# maintenance
maintenance# con
maintenance# configure
maintenance\configure# snmp community rw tayabrw
maintenance\configure# snmp community ro tayabro
maintenance\configure#

..........................
NMS Server login from NMS client:
user: root
Pass: root
ServerIP: 127.0.0.1 port 5188 fixed
....................................
'= Right click and Add device => Give IP -> Give snmp ro and Give snmp rw and connect



//L3 VLAN Tag// create a vlnan 22 name is OptimaxWAN and tagged/joined to the uplink port 6:1;
vlan# vlan-database data OptimaxWAN 22 6:1 tagged

*** IF we want Configure the ONT "auth" mode to "auto-auth" mode
// ONT will be register to the OLT automatically
system# ont
ont# configure
ont\configure#
ont\configure# auth-mode no-auth 1 //config the auth mode to no-auth mode for slot-1
ont\configure# auth-mode no-auth 2
ont\configure# auth-mode no-auth 3
ont\configure# auto-auth enable 1 // enable the ont auto-auth for slot-1
ont\configure# auto-auth enable 2
ont\configure# auto-auth enable 3
ont# display ont-auth-info slotno 1  // See ont-info

***/// Configure Internet services for the ONT

** Troubleshoot /ping
> ping 192.168.10.2
Reply from 192.168.10.2 : bytes=56: icmp_seq=0 ttl=64 time<10 ms
Reply from 192.168.10.2 : bytes=56: icmp_seq=1 ttl=64 time<10 ms

> display uplink configuration all
  port-idx port-state link-state auto-neg  speed duplex learning flow-control pvid prien privalue port-mode
  6:1      enabled    up         on        1000M full   enabled  Off          4088 off   0        sgmii
  6:2      disabled   down       on        1000M full   enabled  Off          4088 off   0        fiber
  6:3      enabled    down       on        1000M full   enabled  Off          4088 off   0        sgmii
  6:4      enabled    down       on        1000M full   enabled  Off          4088 off   0        sgmii
  6:5      enabled    down       on        1000M full   enabled  Off          4088 off   0        optical


=================










Saturday, September 24, 2016

L2 Loop Protection on MikroTik interface


We can use MikroTik feature "Loop-Protect"
Loop protect feature can prevent Layer2 loops by sending loop protect protocol packets and shutting down interfaces in case they receive loop protect packets


GOTO Terminal:: enabling LOOP Protection for Ethernet

## interface ethernet set loop-protect=on 2


*** Three values "ON", "OFF" and "Default" ... default works as turned off 
*** [2 is the number of Ethernet :: use command:: 'interface print'  to see the number of interfaces]

** We can use it by VLAN interface also

## interface vlan set loop-protect=on 3

loop-protect-send-interval (time interval; Default: 5m)
Sets how often loop protect packets are sent on selected interface.

loop-protect-disable-time (time interval | 0; Default: 5m)
Sets how long selected interface is disabled when loop is detected. 0 - forever.



Block Youtube Taffic by MikroTik



Login via Winbox:
Goto: IP --> Firewall --> Filter --> Add -> Chain=Forward --> advance--> Content="googlevideo",

Action= Drop

============

Monday, August 22, 2016

Zimbra Mailbox Size Increase





Login to Zimbra:
[zimbra@smtp ~]# su - zimbra

Check existingMailbox size::
 [zimbra@smtp ~]$ postconf message_size_limit
message_size_limit = 10240000
** Looks 10M ..

We want to increase it 20M::
[zimbra@smtp ~]$ zmprov modifyConfig zimbraMtaMaxMessageSize 20480000

Reload Postfix::
[zimbra@smtp ~]$ postfix reload
/postfix-script: refreshing the Postfix mail system

Check Again::
[zimbra@smtpgw2 ~]$ postconf message_size_limit
message_size_limit = 20480000

Tuesday, August 9, 2016

Zimbra Installation at CentOS 7





1.  vi /etc/hosts
and set hostname

2. Allow iptables to by-pass all zimbra ports

service iptables stop


3.  vi /etc/sysconfig/selinux

SELINUX=disabled


4. Stop any MTA services installed in the server

[root@centos7 ~]# systemctl stop postfix
[root@centos7 ~]# systemctl disable postfix
[root@centos7 ~]# systemctl stop sendmail
[root@centos7 ~]# systemctl disable sendmail

5.Update the OS

[root@centos7 ~]# yum update -y
6.Install the required packages and libraries by issuing the following command :

[root@centos7 ~]# yum install perl perl-core ntpl nmap sudo libidn gmp libaio libstdc++ unzip sysstat sqlite -y


wget https://files.zimbra.com/downloads/8.6.0_GA/zcs-8.6.0_GA_1153.RHEL7_64.20141215151110.tgz

tar xzf zcs-8.6.0_GA_1153.RHEL7_64.20141215151110.tgz


cd zcs-8.6.0_GA_1153.RHEL7_64.20141215151110


./install.sh --platform-override
You can see the following screen when starting the script.

./install.sh --platform-override



#### Finally
su - zimbra
[zimbra@mail ~]$  zmcontrol start
[zimbra@mail ~]$  zmcontrol status

Access admin panel via browser :

https://<your_zimbra_domain.com>:7071


Source: https://www.unixmen.com/install-zimbra-collaboration-suite-8-6-0-centos-7/


------------------------------------------------------------------
Zimbra Domain Block / Restrict  and troubleshooting
-----------------------------------------------------------------

*** Check Mail sender Public IP from LINUX:
root# dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
       //(check either PUBLIC IP is right or wrong)

*** Check Mailq and Delete if needed
root# /opt/zimbra/common/sbin/postsuper -d ALL
root# su - zimbra
[zimbra@mail ~]$ mailq
*** Enable SPAM FILTER ****
[zimbra@mail ~]$ zmlocalconfig -e amavis_dspam_enabled=true


*** Modify "smtpd_sender_restrictions". We are adding a check before allowing a normal smtp connection. Allowing hosts in mynetwork, then allowing sasl authenticated too. Then a check for local domain address.

[zimbra@mail ~]$ postconf mynetworks
[zimbra@mail ~]$ zmprov ms mail.tayabkna.com zimbraMtaMyNetworks '127.0.0.0/8  192.168.10.50/32'
[zimbra@mail ~]$ postfix reload

Bellow commands For Zimbra 8.5 and Above versions.....
[zimbra@mail ~]$ zmprov mcf zimbraMtaSmtpdRejectUnlistedRecipient yes
[zimbra@mail ~]$ zmprov mcf zimbraMtaSmtpdRejectUnlistedSender yes   
[zimbra@mail ~]$ zmmtactl restart
[zimbra@mail ~]$ zmconfigdctl restart 
For Zimbra 8.0.0 versions.... use bellow commands
vi /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf
check_sender_access hash:/opt/zimbra/conf/domainrestrict

#########################

vi /opt/zimbra/conf/domainrestrict
tayabkhan.com ACCEPT
mezan.net     REJECT Not-Permitted
@             REJECT You-Are-Not-Permitted

postmap  /opt/zimbra/conf/domainrestrict

 zmmtactl stop
 zmmtactl start

#####################################

Sunday, July 24, 2016

Juniper IDP via NMS



IDP 8200 using NMS (Network and Security Manager) software



Directly domain block by above method.. must add those to any policy like IIG-Policy,VC, URL Block and also update device(idp8200)


*** Filter by Custom attack...  and must add those to any policy like IIG-Policy,VC, URL Block and also update device(idp8200)

 IDP Object: +
name: BTRC-www.xyz.com
Description: www.xyz.com/collections/4212847/BDR-Mutiny
Severity: major
Category: HTTP
Keywords: collections 4212847 BDR-Mutiny

 Attach Versions: +
    tik mark:
idp-5.1.0
idp-5.1.110120907
idp-5.1.110121210
type: Compund Attack -> Next

 Protocol Type: Service
Service: http (predefined) -> Next

 Scope: Transaction
 Boolean Expression: m01 AND m02
 +
 signature
Member Name: m01
pattern: \[(.*\.)?xyz\.com\]

Context: HTTP : HTTP Header Host (predefined)
Direction: Client to Server
ok
 +
  Member Name: m02
pattern: \[/collections/4212847/BDR-Mutiny\]

Context: HTTP : HTTP URL Parsed (predefined)
Direction: Client to Server

Finish






Saturday, July 23, 2016

MikroTik Schedule reboot Script



/system scheduler
add comment="Reboot every 1 hours" disabled=no interval=1h name=Reboot1hour on-event=\
    "/system reboot" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive \
    start-date=jul/23/2016 start-time=08:00:00

Tuesday, May 31, 2016

Webmin postfix bcc sender receiver


** We want to forward all sending email to @tayabkhan.com domain to tayab@tayabkhan.com
and all receiving emails to @tayabkhan.com domain to tayab@tayabkhan.com

Goto =>> Webmin =>> Servers =>> Postfix Mail Server =>> BCC Mapping =>>

Sender BCC mapping lookup tables:::  hash:/etc/postfix/bcc
Recipient BCC mapping lookup tables:::   hash:/etc/postfix/bcc-receiver

Save and Apply

Click again "BCC Mapping"
Recipient Mappings =>> Add a new mapping
Description:
Name: @tayabkhan.com
Maps to...:  tayab@tayabkhan.om

Save mapping

Sender Mappings =>>Add a new mapping
Description:
Name: @tayabkhan.com
Maps to...:  tayab@tayabkhan.om

Save mapping

Monday, May 16, 2016

Hotmail live outlook Black list remove Link



https://support.microsoft.com/en-us/getsupport?oaspworkflow=start_1.0.0.0&wfname=capsub&productkey=edfsmsbl3&locale=en-us&ccsid=635989770686051940




Register Here to see IP status::

https://sendersupport.olc.protection.outlook.com/snds/data.aspx


Monday, May 9, 2016

Separate Destination domain and Relay Zimbra


** We can relay full server from one server to another server

vi /etc/postfix/main.cf
relayhost = [smtpgw.tayabkhan.com]:587
or
relayhost = [smtpgw.tayabkhan.com]:25

** We can separate a destination domains mail via another SMTP server.

** check tranport_maps are in main.cf
vi /etc/postfix/main.cf

 transport_maps = hash:/etc/postfix/transport

** Login Mail server  and  vi /etc/postfix/transport
hotmail.com             :[smtpgw.tayabkhan.com]

-----------------------------------------
*** Loging to smtpgw(smtpgw.tayabkhan.com) server: and allow IP of mail server in MyNetworks

** if postfix then goto vi /etc/postfix/main.cf and add server ip to mynetworks
mynetworks =  127.0.0.0/8, 192.168.10.0/24

** if Zimbra then,
root@mail# su - zimbra
[zimbra@smtpgw2 ~]$ postconf mynetworks

***Outpur will be like bellow...........
mynetworks = 127.0.0.0/8 192.168.1.0/24 [::1]/128 [fe80::]/64

*** Add your mx server IP 10.10.10.200 by bellow command
[zimbra@smtpgw2 ~]$  zmprov ms smtpgw2.tayabkhan.com zimbraMtaMyNetworks '127.0.0.0/8 192.168.1.0/24 10.10.10.200/32 [::1]/128 [fe80::]/64'

[zimbra@smtpgw2 ~]$  postfix reload

Zimbra SMTP MTA Relay



*** If any Zimbra Server IP black listed and Urgent need to send emails via other SMTP server then follow bellow steps.


** Go To the Zimbra Admin Panel

https://smtpgw.tayabkhan.com:7071/zimbraAdmin/

** If you forgot admin password then login to SHELL by root

root@mail# su - zimbra

[zimbra@mail ~]$  zmprov sp admin@tayabkha.com AdminPassword

** Login by admin password

** Click "Configure" TAB
** Click "Global Settings"
** Click "MTA"
**  Realy MTA for External Delivery :  192.168.72.20  port 25  (**Set SMTP servers IP and Port)
** Save settings

#### Go To the smtp Server: 192.168.72.20  login by root

** Vi /etc/postfix/main.cf
Add Zimbra-Server-IP to MyNetwork
mynetworks =  smtpgw.tayabkhan.com

============================
====================================
*** If other Mail Server (MX) 10.10.10.200 wants to send(relay) emails through Zimbra server(smtpgw2.tayabkhan.com),, follow bellow steps....
root@mail# su - zimbra
[zimbra@smtpgw2 ~]$ postconf mynetworks

***Outpur will be like bellow...........
mynetworks = 127.0.0.0/8 192.168.1.0/24 [::1]/128 [fe80::]/64

*** Add your mx server IP 10.10.10.200 by bellow command
[zimbra@smtpgw2 ~]$  zmprov ms smtpgw2.tayabkhan.com zimbraMtaMyNetworks '127.0.0.0/8 192.168.1.0/24 10.10.10.200/32 [::1]/128 [fe80::]/64'

[zimbra@smtpgw2 ~]$  postfix reload




Thursday, May 5, 2016

Wireshark CISCO Port monitoring


Port Monitoring by Wireshark  with a CISCO Switch

Server-Switch#conf t
monitor session 1 source interface gi0/13
monitor session 1 destination interface gi0/24
exit

sh monitor

Now connect Wireshark PC directly to port 24 and start capture data of port 13.

Wednesday, March 23, 2016

Netflow from Juniper and Cisco



Juniper Netflow::

Our Example Flow Server: 192.168.1.10 and we want to send traffic of ge-1/0/7
We can send all interfaces traffic by setting SNMP


set forwarding-options sampling input rate 100
set forwarding-options sampling input run-length 9
set forwarding-options sampling input max-packets-per-second 7000

set forwarding-options sampling family inet output flow-server 192.168.1.10 port 9996
set forwarding-options sampling family inet output flow-server 192.168.1.10 version 5

set firewall filter all term all then sample
set firewall filter all term all then accept

set interfaces ge-1/0/7 unit 0 family inet filter input all
set interfaces ge-1/0/7 unit 0 family inet filter output all

Tuesday, March 8, 2016

MikroTik Interface Traffic Shape



queue simple
      name="Limit ether1" dst-address=0.0.0.0/0 interface=ether1 parent=none
      direction=both priority=8 queue=default-small/default-small
      limit-at=256k/256k max-limit=256k/256k burst-limit=0/0
      burst-threshold=0/0 burst-time=0s/0s total-queue=default-small
  

Thursday, March 3, 2016

Multiple FTP User for same home directory in VSFTP


*** Two FTP User Tayab and Khan will share same home directory to upload and download /var/www/html/career

cd /var/www/html
adduser tayab -d /var/www/html/career/
chown -R tayab:tayab careerbd
passwd tayab
adduser khan -d /var/www/html/career/ -g tayab
passwd khan
chmod g=rwx -R *
***
vi /etc/vsftpd/user_list
tayab
khan
------------
CentOS VSFTPD File
==================
root# cat /etc/vsftpd/vsftpd.conf
# ============================
#local_umask=07
anonymous_enable=NO
chroot_local_user=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
ftpd_banner=Welcome to Jobsbd's FTP service- by Tayab Khan.
listen=YES
pasv_min_port=2121
pasv_max_port=2142
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
userlist_deny=NO
syslog_enable=YES
xferlog_enable=NO
vsftpd_log_file=/var/log/vsftpd.log
xferlog_std_format=NO
log_ftp_protocol=YES
# =================================

Ubuntu VSFPTD FILE...
===============
root@www:~# grep "^[^#;]" /etc/vsftpd.conf
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES
pasv_enable=Yes
pasv_min_port=40000
pasv_max_port=40100
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=ftp
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
allow_writeable_chroot=YES
----------------------
vi  /etc/vsftpd.user_list
tayab
khan
=================

login via coreftp

Wednesday, February 24, 2016

http to https auto redirect for webmin virtualhosts



*** WE have a site  http://mail.tayabkhan.com and we need to redirect https://mail.tayabkhan.com

IF we use virtualmin then edit Virtual Host-> eanble features -> tick  SSL website enabled?
If  there is not virtualmin, webmin then generate ssl.cert and ssl.key and use in virtualhost.

Edit httpd.conf file...

NameVirtualHost *:80
NameVirtualHost 192.168.10.10:443


<VirtualHost 192.168.10.10:443>
ServerAdmin webmaster@tayabkhan.com
ServerName  mail.tayabkhan.com
DocumentRoot /home/tayabkhan/public_html
ErrorLog /var/log/virtualmin/tayabkhan.com_error_log
CustomLog /var/log/virtualmin/tayabkhan.com_access_log combined


    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile    /home/tayabkhan/ssl.cert
    SSLCertificateKeyFile /home/tayabkhan/ssl.key
    SetEnvIf User-Agent ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
</VirtualHost>

<VirtualHost *:80>
    ServerName mail.tayabkhan.com
    Redirect / https://mail.tayabkhan.com/
</VirtualHost>

<IfDefine SSL>
<IfDefine !NOSSL>


</IfDefine>
</IfDefine>


Sunday, January 24, 2016

cacti interface description in graph




Goto the Admin Console ->

Graph Management ->


 Title (--title)
The name that is printed on the graph.



Replace  host_description  to query_ifAlias



|query_ifAlias| - Traffic - |query_ifName|

and save......




Sunday, January 3, 2016

CloudFlare to speeds up and improves availability for a website



CloudFlare is a free service that accelerates and secures your website by acting as a proxy between your visitors and HostGator servers. With CloudFlare, you can protect your website against malicious visitors, save bandwidth and reduce average page load times.

At first you have to sign up from https://www.cloudflare.com 

and Add your website 
and Also need to change your Name Servers of your domain. 

You can choose any plan... Free... Pro ..... Business..... Enterprise...





Saturday, January 2, 2016

Mysql Error: Unable to lock ./ibdata1, error: 11



Mysql Error:  Unable to lock ./ibdata1, error: 11


If mySQL not start from server command line,, /etc/init.d/mysqld start

that see the log files from another terminal

tail -f /var/log/mysqld.log
IF

Unable to lock ./ibdata1, error: 11


Then....


cd /var/lib/mysql
cp -a ibdata1.bak ibdata1
service mysqld restart

service mysqld restart