Tuesday, 19 February 2013

How to Create NAT Rule on Router for Access the Internet

Before we get started, take a look at Figure A, this offers an illustration of what our example network looks like.

Figure A

If you're wondering why using NAT is necessary, it's because we choose the IP address scheme for the LAN from the blocks of private IP addresses. Because these IP addresses aren't usable on the Internet, we must translate these IP addresses into a real Internet IP address, such as one provided by an ISP.

So, we'll use NAT to provide the IP address translation from our LAN to our WAN. While most consumer-based routers refer to NAT as a ubiquitous term, there are a few different kinds of NAT, including static NAT, pooled NAT, and NAT overload (also called port address translation, or PAT).

Consumer-based routers typically use NAT overload, which is what we'll use for this example. NAT overload involves using a single Internet IP address and multiple inside IP addresses.

Let's look at the step-by-step process for configuring NAT overload. The router needs to be in Global Configuration Mode, and the prompt should look like this: Router(config)#

Create a pool of Internet IP addresses

For this example, we're going to overload a single Internet IP address. Since this is the only IP address we have, we'll create a pool with only one IP address in it.


Router(config)# ip nat pool mypool 1.1.1.1 1.1.1.1 prefix 30

Create an access list

Next, we must determine who the router allows to use NAT to access the Internet using our NAT pool, which we can accomplish by creating an access list. For this example, we'll allow the entire internal network to use NAT to access the Internet.


Router(config)# access-list 1 permit 192.168.1.0 0.0.0.255
 
 

Create the NAT source list

Now, we must connect the pool and the list of users. We can accomplish this by telling the router that we want to use NAT from the inside (using the access list to define our possible source IP addresses) and go to the outside using the pool that contains our single Internet IP address. In addition, we want to overload this single Internet IP address using PAT.

Router(config)# ip nat inside source list 1 pool mypool overload
 
 

Define the inside and the outside NAT interfaces


Next, we need to tell the router which interface is the inside and which is the outside.
Router(config)# interface ethernet 0/0
Router(config-if)# ip nat inside
Router(config-if)# exit
Router(config)# interface serial 0/0
Router(config-if)# ip nat outside
Router(config-if)# exit 

That's it.
 

Monday, 7 January 2013

Route Precedence

Few days back one of my friend ask me, if we have three routes

10.10.10.0/24 via bgp
10.10.10.0/24 via ospf
10.10.0.0/16 via eigrp

which route will take for 10.10.10.1??

Then I start searching  the  answers on net and luckily find a solution.  

Now the basic funda is,

Route selection precedence is as follows

1. Most Specific route
2. AD value
3. Metric


Now here most specific routes are

10.10.10.0/24 via bgp
10.10.10.0/24 via ospf

Now AD value will come in the picture as tie breaker....

Take a look at the following Table for AD values

Default Administrative Distances
Connected 0
Static 1
eBGP 20
EIGRP (internal) 90
IGRP 100
OSPF 110
IS-IS 115
RIP 120
EIGRP (external) 170
iBGP 200
EIGRP summary route 5


Now the Answer is a question, Which BGP route was that, EBGP or IBGP??

If it is IBGP (AD value: 200), OSPF routes will get precedence…. Else it gonna take BGP routes (AD Value: 20)

Internet Explorer : Error Codes - Explained

52 Runtime Error

This is a "bad file name or number" error in JavaScript.

It means that the script cannot find a file it is looking for (web-page, course component) and is most likely a connectivity problem.

Try to clear your temporary internet files which should resolve any further problems... If this does not then speak with the website administrator as there may be a problem with the websites server.


400 Bad File Request

Usually means the syntax used in the url is incorrect (e.g. uppercase letter should be lowercase letter; wrong punctuation marks)


401 Unauthorised

The website server is looking for some encryption key(s) from the client (your computer) and is not getting it. Also, a wrong password may have been entered. Try it again, paying close attention to case sensitivity..


403 Forbidden/Access Denied

Similar to 401, special permission is needed to access the website A password and/or username may not be correctly registered on the websites database. Other times the website server may not have the proper permissions set up on its directories...


404 File Not Found

Server cannot find the file you requested. Refreshing the page (F5) should resolve this problem, although continued error messages may mean the page is no longer available, that there is considerable internet congestion (in which case the user should try again later).

Alternatively the file could have been either been moved or deleted, or you entered the wrong URL or document name. Look at the URL. If a word looks misspelled, correct it and try it again. If that doesn't work backtrack by deleting information between each backslash, until you come to a page on that site that isn't a 404.

From there you may be able to find the page you're looking for. This has to be the most common Internet Explorer Error message on the Internet!


408 Request Timeout

Client (your computer) stopped the request before the server finished retrieving it. A user will either hit the stop button, close the browser, or click on a link before the page loads. Usually occurs when servers are slow or file sizes are large.


500 Internal Error

Couldn't retrieve the HTML document because of server-configuration problems.

Contact website administrator...


501 Not Implemented

Web server doesn't support a requested feature.


502 Service Temporarily Overloaded

Server congestion; too many connections; high traffic. Keep trying until the page loads. This can be a common occurrence at peak news times eg. the Twin Towers during September 2001 brought CNN and the BBC news sites to a slow crawl and many folks got this error.


503 Service Unavailable

Server busy, site may have moved, or you lost your dial-up Internet connection!


Bad File Request

Browser may not support the form or other coding you're trying to access.


Connection Refused by Host

Either you do not have permission to access the site or your password is incorrect. Try again!


Errors on Page

This error message is a catch-all statement meaning there is something on the web page that the browser either hasn't read properly (connectivity problem) or there are missing items in the web page itself. This problem normally affects the graphics on a web page.

This can be a temporary glitch (caused by insufficient bandwidth), and may be quickly resolved, or it can have a more complex and longer term problem. With regard to most cases of this Internet Explorer Error message, it is due to not having given sufficient time to download the page you are requesting.

It is necessary to wait until the bottom left hand corner of the page reads 'done' before selecting any other links on the page to move forward.


Failed DNS Lookup

The Domain Name Server can't translate your domain request into a valid Internet address. The website server may be busy or down, or incorrect url (web address) was entered.


File Contains No Data

Page is there but is not showing anything. Error occurs in the document. Attributed to bad table formatting, or stripped header information....


Host Unavailable

Host server down. Hit reload or go to the site later


Network Connection Refused by the Server

The Web server is busy. To resolve this problem, refresh the page. (Press Ctrl and F5).


Runtime Error

(The information in this solution applies to: Internet Explorer 5.5 (SP1) 95 / 98 / 98 Second Edition / NT4.0 / 2000). When you attempt to browse to various websites, you may receive an error message similar to the following 'A runtime error has occurred. Do you wish to debug? Line number Error: Permission Denied.'

This can occur if you upgrade to IE 5.5 (SP1). The upgrade enables the script-debugging and script-error-notification options. (Note: Because there are several versions of Windows, the following steps may be different on your computer. If they are, please consult your product documentation to complete these steps:)

To resolve this issue, disable the script-debugging and script-error-notification options. To do this, follow these steps:

1. Start Internet Explorer.
2. On the Tools menu, click Internet Options.
3. Click the Advanced tab .
4. Click to select the Disable script debugging check box .
5. Click to clear the Display a notification about every script error check box .
6. Click Apply, and then click OK.
Fortunately this is a very rare Internet Explorer Error message...


Script Error

Script errors are caused when something goes wrong when surfing some web pages. It is caused by VBScript or JavaScript code that is embedded within certain web pages. These errors are mostly due to connectivity problems, though can occasionally be caused by browser incompatibilities. Ensure that you have a compatible browser version (IE 5.5 and above or Netscape 4.76 and above).


Unable to Locate Host

Host server is down, Internet connection is lost, or URL typed incorrectly.

If refreshing the page doesn't work, try clearing the Temporary Internet Files and History and refreshing again. You may have to wait until later.

How to Know Nokia Hardware - Model - Serial Number

FW [Admin]# cat /var/etc/.nvram
Vendor Nokia
Chassis serialnum: 93063100325
Model IP390
FW [Admin]#

Saturday, 5 January 2013

Useful Netscreen Commands for Troubleshooting

Netscreen Commands for Troubleshooting:
Here is some useful Netscreen commands for troubleshooting.

get config : to get device configuration
save : to save changes to config
get system : gets system information, Netscreen mode
get session info : shows load on the firewall 85+ implies there will be some latency
get interface : shows interfaces, zones
get address trust/unturst: shows defined network objects
get Arp : shows firewall Arp entries
get route : shows firewall routes
get service : shows firewall services
get group address : network groups
get group service : service groups
get policy in/out : shows applied firewall policies
get log traffic : shows firewall logs – options: based on src/dst/IP/port
unset : to remove a config statement
get user all : shows vpn users
get log event : shows vpn logs
get MIP : shows one to one Nat’s
get VIP : shows configured port forwarding rules
get route ip x.x.x.x: finds the specific route for an ip
set policy id xx : put you in a specific policy then you can add more objects it instead of creating a group

Basic Netscreen Commands

Basic NETSCREEN Firewall Commands
If you are new to managing the Netscreen Firewall, then these commands will help you in managing the Netscreen Firewall from the Command Line Interface.

NETSCREEN
Note:Always remember to use the TAB when you are not sure the syntax of the command for a Netscreen Firewall. When you press TAB on your keyboard, it would give you what the next options are, and you can chose from the same. TAB is your best friend.

Step 1: define networks & network groups
***********************************************
Set address trust int-10.1.1.0_24 10.1.1.0/24
Set address untrust ext-192.168.15.15 192.168.15.15/32
Set group address untrust Remote
Set group address untrust Remote add ext-192.168.15.15

Step 2: define services & service groups
**********************************************
Set service tcp_445 protocol tcp src-port 1024-65535 dst-port 445-445 timeout 120
Set service tcp_3399 protocol tcp src-port 1024-65535 dst-port 3390-3390 timeout 120
Set group service outsrvgroup1
Set group service outsrvgroup1 add http
Set group service outsrvgroup1 add https

Step 3: Define policies
*************************
set policy from trust to untrust int-10.1.1.0_24 any outsrvgrp1 permit log count
Note: policies are applied from zone to zone.

Step 4: define NAT
**********************
NAPT is on by default.

Step 5: define one to one NAT (MIP)
*****************************************
Set interface untrust MIP 192.168.1.15 host 10.1.1.15 netmask 255.255.255.255
Set group service insrvgroup1
Set group service insrvgroup1 add http
Set group service insrvgroup1 add https
Set policy from untrust to trust any MIP(192.168.1.15) insrvgroup1 permit log count
Set policy move 59 before 4
(Move the new policy is before the default deny policy)

Step 6: define port forwarding (VIP)
*****************************************
Set interface untrust VIP 192.168.1.55 443 https 10.1.1.55
Set policy from untrust to trust any VIP::1 https permit log count

Step 7: define routes
************************
Set route 10.1.1.0/24 gateway 192.168.1.254

Friday, 4 January 2013

Fortigate firewall demo free access. Also FortiManager and FortiAnalyzer

As someone said best things in life are free.

Here are links to the demo Forigate firewall, ForiAnalyzer and FortiManager open to access from anywhere . So that you can familiarize yourself with the Management GUI look and feel.


NOTE: Access is read-only.
NOTE 2: No , it is not me being so generous, it’s Fortinet caring for us.


Fortigate 300 :
user:demo
password: fortigate
fortigate.com


ForiAnalyzer 800:
user:demo
password: fortianalyzer
fortianalyzer.com 


FortiManager 400:
user:demo
password: fortimanager
fortimanager.com

Thursday, 6 December 2012

Configure Layer 3 EtherChannel between Cisco Router and Switch

Router:

interface Port-channel1
ip address 10.4.4.2 255.255.255.252
!
interface GigabitEthernet0/0/0
no ip address
channel-group 1
no shutdown
!
interface GigabitEthernet0/0/1
no ip address
channel-group 1
no shutdown

Switch:

interface Port-channel1
no switchport
ip address 10.4.4.1 255.255.255.252
!
interface GigabitEthernet1/0/3
no switchport
no ip address
channel-group 1 mode on
no shutdown
!
interface GigabitEthernet2/0/3
no switchport
no ip address
channel-group 1 mode on
no shutdown

(Note: Reference of this post is http://firewalltipss.blogspot.in/2011/07/configure-layer-3-port-channel.html )

Linux Cheat Sheet

COMMAND INPUT

The colors designate the actual Linux command in blue, while the user input (file, numeric value, etc) is red. 

Basic Operation

#hostame - Displays the hostname and/or FQDN of the system 

#uname -a - Displays the hostname and detailed kernel version 

#cat /etc/redhat-release - Displays the version of Linux installed Example: 

#cat /proc/cpuinfo - Displays information about the CPU(s) 

#df -h - Displays the partitions, their sizes details, and mount points 

#free - Displays detail about the system memory and usage 

#lsof - Displays all open files 

#lsof -nPi:22 - Displays any open files which use port 22 

#locate httpd.conf - Displays the full path to any file named httpd.conf 

#updatedb - Rebuilds index of files for search using the locate utility 

Copy, Move, Delete
#cp file1.txt file2.txt - Copies file1.txt to file2.txt 

#mv old.txt new.txt - Renames a file called old.txt to new.txt 

#rm file1.txt - Deletes file1.txt 

#mkdir httpds - Creates a new directory called httpds 

#cp -R httpd httpds - Recursively copies all files from directory httpd to httpds 

#cp -PR httpd httpds - Recursively copies all files from directory httpd to httpds and retains all permission settings 

#rm -rf httpd - Recursively deletes folder httpd and all contents 

#chkconfig --list - Displays all services and their state (start or stop) at each runlevel 

#chkconfig --level 35 httpd on - Sets httpd to start on runlevels 35 when machine is booted 

#service httpd start - Immediately starts Apache 

File Attributes
#chown apache virtualhosts.txt - Changes ownership of the virtualhosts.txt file to user apache 

#chgrp apache virtualhosts.txt - Changes membership of the virtualhosts.txt file to group apache 

#chmod a+x sniffer.pl - Allows the sniffer.pl file to be executed 

CHMOD
7 rwx read, write, execute 
6 rw- read, write 
5 r-x read, execute 
4 r-- read 
3 -wx write, execute 
2 -w- write 
1 --x execute 
0 --- no permissions
 

#chmod 777 passwords.txt - Allows read, write, and execute on the file passwords.txt to anyone 

#chmod 000 passwords.txt - Blocks read, write, and execute on the file passwords.txt to anyone 

Yum
#yum update -y - Updates all packages without prompting 

#yum install iptraf - Installs a package named iptraf 

#yum whatprovides */iostat - Searches all repositories and returns RPMs that provide the program iostat 

#yum update samba - updates a package named samba 

RPM
#rpm -q http - Displays the version of daemon http (apache) 

#rpm -qa | grep bind - Displays all packages installed with the word bind. Example: 


#rpm -qa | grep bind 
bind-chroot-9.3.6-16.P1.el5 
system-config-bind-4.0.3-4.el5.centos 
bind-utils-9.3.6-16.P1.el5 
bind-9.3.6-16.P1.el5 
bind-libs-9.3.6-16.P1.el5 
ypbind-1.19-12.el5
 

#rpm -ivh proftpd - Interactively installs proftpd 

#rpm -Uvh proftpd - Interactive upgrades named proftpd 

#rpm -e proftpd - Removes package proftpd 

#rpm --rebuilddb - Rebuilds a corrupt RPM database 

Compressed files
#unzip package.zip - Unzips the file package.zip 

#tar -zvxf stunnel.tar.gz - Decompressed a gzip file named stunnel.tar.gz 

Networking

#ifup eth0 - Enables network interface eth0 

#ifdown eth0 - Disables network interface eth0 

#vi /etc/sysconfig/network-scripts/ifcfg-eth0 - Uses vi to edit network settings on eth0 

IP tables
#service iptables status - Displays status of iptables (running or not) 

#iptables -L - Displays ruleset of iptables 

#iptables -I INPUT -p tcp -m tcp -s 192.168.15.254/26 --dport 22 -j ACCEPT - Accepts incoming SSH connections from IP range 192.168.15.254/26 
#iptables -I INPUT -p tcp -m tcp -s 0.0.0.0/0 --dport 22 -j DROP - Blocks SSH connections from everywhere else 

#iptables -I INPUT -s "192.168.10.121" -j DROP - Drops all traffic from IP 192.168.10.121 

#iptables -D INPUT -s "192.168.10.121" -j DROP - Removes previously allied drop all from IP 192.168.10.121 

#iptables -I INPUT -s "192.168.10.0/24" -j DROP - Drops all traffic from IP range 192.168.10.0/24 

#iptables -A INPUT -p tcp --dport 25 -j DROP - Blocks all traffic to TCP port 25 

#iptables -A INPUT -p tcp --dport 25 -j ACCEPT - Allows all traffic to TCP port 25 

#iptables -A INPUT -p udp --dport 53 -j DROP - Blocks all traffic to UDP port 53 

#/etc/init.d/iptables save - Saves all IPtables rules and re-applies them after a reboot


Processes
#ps ax - Displays all running processes 

#ps aux - Displays all running processes including CPU and memory usage of each 

#ps ax | wc -l - Displays the total number of processes 

#top - Interactive process manager which allows sorting by criteria
Logs
#tail -f /var/log/messages - Displays the most current entries to the messages log in real-time 

#tail -50 /var/log/messages - Displays the last 50 lines of the messages log 

#head -50 /var/log/messages - Displays the first 50 lines of the messages log 

#cat /var/log/messages - Displays the entire messages log 

#cat /var/log/messages | grep "FTP session opened" - Displays any entries in the messages log that contain the ext FTP session opened 

#cat /var/log/messages | grep "FTP session opened" > log2.txt - Writes any entries in the messages log that contain the ext FTP session opened to a file named log2.txt 

Paths to Common Files

Bind (named)
/var/named - Bind zone files (non chrooted) 
/etc/named.conf - Bind configuration file (non chrooted) 
/var/named/chroot/var/named - Bind zone files (chrooted) 
/var/named/chroot/etc/named.conf - Bind configuration file (chrooted) 

Apache (httpd)
/etc/httpd/conf/httpd.conf - Main apache configuration file 
/var/www/html - Default directory for serving pages 
/var/log/httpd/ - Default location for logs (access and error) 

Networking
/etc/hosts - System hosts file 
/etc/resolv.conf - DNS lookup configuration file 
/etc/sysconfig/network - Network/hostname configuration file 
/etc/selinux - SELinux configuration file 
/etc/sysconfig/network-scripts/ - Default location of a network setting file 
/etc/sysconfig/iptables - Default iptables policy configuration file 
/etc/sysconfig/iptables-config - Default iptables daemon configuration file


(Note: Reference of the above post is http://firewalltipss.blogspot.in/search/label/Cheat%20Sheets )

Subnet Masks Cheat Sheet


The tables below are commonly used subnet masks and hosts.



Class C


Mask Notation  Subnets  Hosts 
255.255.255.0/241256
255.255.255.128/252128
255.255.255.192/26464
255.255.255.224/27832
255.255.255.240/281616
255.255.255.248/29328
255.255.255.252/30644
255.255.255.254/311282
255.255.255.255/322561


Class B


Mask Notation  Subnets  Hosts 
255.255.0.0/16165,536
255.255.128.0/17232,768
255.255.192.0/18416,384
255.255.224.0/1988,192
255.255.240.0/20164,096
255.255.248.0/21322,048
255.255.252.0/22641,024
255.255.254.0/23128512
255.255.255.0/24256256


Class A


Mask Notation  Subnets  Hosts 
255.0.0.0/8116,777,216
255.128.0.0/928,388,608
255.192.0.0/1044,194,304
255.224.0.0/1182,097,152
255.240.0.0/12161,048,576
255.248.0.0/1332524,288
255.252.0.0/1464262,144
255.254.0.0/15128131,072
255.255.0.0/1625665,536


(Note: Reference of the above post is http://firewalltipss.blogspot.in/search/label/Cheat%20Sheets )