Wednesday, May 22, 2013

How to install SecurePlatform/Gaia from a USB device on Check Point appliance and Open Servers?


Solution ID:sk65205
Product:Security Gateway, Security Management
Version:NGX R65, R70, R71, R75, R76
OS:SecurePlatform, SecurePlatform 2.6, Gaia
Platform / Model:All
Date Created:06-Sep-2011
Last Modified:18-Mar-2013

ISOmorphic is the utility for creating a bootable USB device, capable of installing SecurePlatform and Gaia on Check Point appliances and Open Servers (for USB installation on IP Appliances, see sk83200).
Note: To view the list of USB flash keys that are known to work with ISOmorphic, see sk92423.
To use ISOmorphic, perform the following steps:
A. Prepare the USB device
1. Make sure you have the SecurePlatform/Gaia ISO file corresponding to the appliance model you need to install and the relevant release.
Note: Installing from VSX NGX R67.10 ISO is not supported using ISOmorphic.
2. Run the ISOmorphic tool (download here)
ISOmorphic Settings
3. Choose the Source SecurePlatform/Gaia ISO file
4. Choose the destination drive
5. Press the "Go!" button. A warning message will appear
ISOmorphic confirmation screen
Note: all data on the USB device will be erased.
6. Verify your selections. Write "yes" in the new warning window to confirm the USB drive formatting.
The USB drive is being prepared. A window that displays the progress is displayed
ISOmorphic progress screen
Wait until the steps are completed.
ISOmorphic success
Now you may remove the USB drive.
The USB is now ready for the installation
B. Install the Appliance/Open Server
1. Connect the USB device to the machine
2. Turn on the machine. Once booted successfully via the USB drive, syslinux window will appear.
Note: If the machine did not boot from the USB device check the BIOS settings.
Syslinux screen
You should type the boot option according to the connection type you are using:
vga - for VGA or other graphic mode connection
serial - for serial connection (e.g. console connection on Appliances)
The "smart1" option is for installing Smart-1 150 Appliance
Note: If no option is typed, after 90 seconds the installation will be aborted and the machine will boot from the local drive.
2. The installation process starts and continues the same way as CDROM installation.
Note: On some of SecurePlatform versions the system needs to know from which partition to load the SecurePlatform image.
Partition select
Usually you should select the last option on the list




    Note:
    The following message might appear on the screen during installation:
    find: /tmp/hdimage/Name_Of_ISO_Image.iso: Value too large for defined data type

    Example:
    find: /tmp/hdimage/Check_Point_R75.20_Appliance.iso: Value too large for defined data type

    Root cause:
    Busybox that is used for SecurePlatform installation from USB Storage was not compiled with 64bit file-offsets (_FILE_OFFSET_BITS=64). The ramdisk on the USB Storage mounts the ISO image, and then mounts 'stage2.img' from the ISO image, afterwards it unmounts the ISO image, and 'stage2.img' remounts the ISO. When 'stage2.img' is running, 'find' command complains when it sees an ISO file bigger than 2 GB.

    Clarification:
    This message can be safely ignored. The installation completes successfully, and installed software works correctly.
    Busybox with 64bit file-offset support was integrated into:
    • VSX NGX R67.10
    • future Gaia OS release

    Remember:
    • ISOmorphic can be used for fresh install only.
    • ISOmorphic is provided as a utility to ease installation.
    • Customers can use any tool they want to format their flash keys. Check Point does not enforce the usage of ISOmorphic.

    Friday, May 17, 2013

    Secure IOS Template Version 6.4 04 APR 2013

    http://www.cymru.com/Documents/secure-ios-template.html

    Secure IOS Template Version 6.4 04 APR 2013

    By Team Cymru, noc at cymru.com

    Documents ]       [ Home ]

    Introduction

    One of the challenges of any network is how to mitigate, if not deny, the various attacks launched daily on the Internet. While blocking the script kiddies and their attempts to gain root or scan a subnet is one challenge, a greater challenge has been to mitigate the DDoS attacks. While nothing is foolproof, layers of protection can be applied to the problem.
    Taking a holistic view of the challenge led to the creation of the layered approach. In this approach, the following philosophies are applied:

    1. The border router provides for protocol protection and defends itself and the firewall.
    2. The firewall provides port protection and defends itself and the host residing behind it.
    3. The end stations are configured to survive various DOS attacks as well as to reduce the number of noxious services which might be exploited.
    This results in the "funnel effect," wherein progressively less nasty traffic comes through the overall pipe. The network is "crunchy through and through," not just at the edges.
    A brief aside - If you are interested in tuning your UNIX systems to provide additional defense against myriad attack types, please peruse my UNIX IP Stack Tuning Guide.
    The purpose of this document is to introduce the first wall of defense, the router. The attached template provides a work in progress towards the goal of a secure border device. This template does not cover router or routing protocol basics, and only lightly touches on the topic of router performance tuning (e.g. using the loopback device instead of the null device for black hole routes). For more on router performance tuning tips, please see my Cisco Router Performance Tuning document.
    As an added bonus, George Jones has written a tool, NCAT, that will validate Cisco router configurations. Using a template configuration, NCAT will ensure that any router configuration adheres to the policies in the template. I highly recommend this tool. You will find it at ncat.sourceforge.net.
    We no longer list the bogons in this template, so please look for detailed bogon insight on our Bogon List.
    Barry Greene and Philip Smith, both formerly of Cisco, have published a book entitled Cisco ISP Essentials. This is an excellent collection of clue. You can learn more about it at www.ispbook.com.
    Cisco maintains a nice collection of security documents here.

    Credits

    I truly appreciate the suggestions, bug reports, and thoughtful discourse provided by these folks. Thank you!

    Bruce Babcock
    Alison Gudgeon
    Paul Jacobs
    Deepak Jain
    George Jones
    Christian Koch
    Mark Kent
    Thomas Kernen
    John Kristoff
    Christopher Morrow
    Hank Nussbacher
    Johan van Reijenda
    Ken Reiss
    Rafi Sadowsky
    Steve Snodgrass
    Alfredo Sola
    David Wolsefer
    And, of course, the FIRST community.

    Overview

    The Cisco Secure IOS Configuration Template is simply a template, or a starting point. Individual sites will need to modify the template to varying degrees. For example, the template does not include any routing protocol information. This would make the template far too large and specific. Although one could argue that a BGP configuration would meet the needs of a great many border routers, it was decided to shelve that piece for another template. You may wish to peruse my Secure Cisco BGP Configuration Template to assist you in securing your BGP configuration. As with all templates, your mileage may vary.
    The template has undergone a trial by fire, protecting various sites. In one case, a modified version of this template protects a site that endures upwards of 10000 attacks per day. The template has weathered the storm well, although not without some real time modification. As the instruments and methods of the malcontents change, so do the attack styles. However, this template has yet to fail, and the sites behind it have remained on-line throughout attacks of moderate to great intensity.
    Clearly, hardware counts. A 2501 with this template will not provide much in the way of protection, and certain features of this template will not work on the lower tier of Cisco routing products. The template was written with a Cisco 7000 or greater model in mind.
    This template is not a panacea. It will not stop all attack types. It is simply a part of a larger design. Remember the layered approach.


    Decisions, Decisions

    As noted, the template must be modified to fit the environment. Obviously such things as IP addresses and routes must be changed. How ever, there are other decisions to be made. The IP address of the FTP, TACACS+, and syslog servers must be noted, for example.
    Enabling the anti-spoofing feature of CEF (reverse-path) is another thorny issue for those with the potential for asymmetric data flows. In this case, ACLs should be used for anti-spoofing protection. Both options are provided in the template.
    Determining the proper CAR limits for multicast, ICMP, and UDP is quite site specific. While some defaults have been placed in the configuration, it is best to size the pipe and modify the limits accordingly. It is difficult to model a situation where ICMP should be allowed more than 575Kb/s of bandwidth, however your mileage may vary.


    Caveats

    As with all things, test test test. Do not deploy a configuration without thoroughly testing it in a non-production environment. If you do not understand the commands or the accompanying comments, do not utilize them. You may find yourself in a sticky debugging session at some point, so complete understanding of the configuration is highly recommended.
    This template WILL NOT WORK without modification to suit your gear and topology!

    Question, Comments, Suggestions

    This is a work in progress, and feedback from those who use the template, have their own bag of tricks, or endure malicious attacks is most welcome! If you have questions, I will do my best to answer them and assist you. Please route all commentary and questions to [email protected].
    I hope you find this helpful in your effort to fend off the Internet vandals!


    Template

    The commands are in BOLD text so that they stand out from the surrounding comments.
    ! Secure router configuration template.
    ! Version 6.4
    ! @(#)Secure IOS template v6.4 04 APR 2013 Team Cymru [email protected]
    ! @(#)https://www.cymru.com/Documents/secure-ios-template-64.html
    !
    ! This configuration assumes the following topology:
    !
    Upstream/Internet
    ! 192.0.2.1/28
    !       |
    ! 192.0.2.14/28 (Ethernet 2/0)
    THIS ROUTER
    ! 192.0.2.17/28 (Ethernet 2/1)
    !       |
    ! 192.0.2.30/28
    Firewall
    ! 192.0.2.33/27
    !       |
    ! 192.0.2.32/27
    Intranet
    !
    ! In this case, 192.0.2.34 is the loghost, FTP server, etc.
    ! for the router. It could also be the firewall if
    ! circumstances dictate.
    !
    service nagleservice tcp-keepalives-inservice tcp-keepalives-out!
    ! Show copious timestamps in our logs
    service timestamps debug datetime msec show-timezone localtimeservice timestamps log datetime msec show-timezone localtime! Ensures all passwords and secrets are obfuscated when looking at
    ! configuration files
    service password-encryptionno service dhcp!
    hostname secure-router01!
    boot system flash slot0:rsp-pv-mz.121-5a.binlogging buffered 16384 debuggingno logging console! The keyword 'secret' ensures MD5 is used when 'service password
    ! encryption' is used (above.) The keyword 'password' uses a mechanism
    ! which is simple to reverse-engineer and should be avoided
    enable secret <PASSWORD>no enable password!
    ! Use TACACS+ for AAA. Ensure that the local account is
    ! case-sensitive, thus making brute-force attacks less
    ! effective.
    aaa new-modelaaa authentication login default group tacacs+ local-caseaaa authentication enable default group tacacs+ enableaaa authorization commands 15 default group tacacs+ localaaa accounting exec default stop-only group tacacs+aaa accounting commands 15 default stop-only group tacacs+aaa accounting network default stop-only group tacacs+tacacs-server host 192.0.2.34tacacs-server key cheezit!
    ! In the event that TACACS+ fails, use case-sensitve local
    ! authentication instead. Keeps the hackers guessing, and
    ! the router more secure.
    username <USERNAME> secret <PASSWORD>!
    ! Logging the commands run while at enable level access is
    ! a great way to track mistakes, security issues, etc.
    archive
     log config
      logging enable
      logging size 500
      notify syslog
      hidekeys
    !
    ! Ensure TCL doesn't use an initilizaion file where available. This won't show up in the
    ! config. It will break your router-based TCL scripts if
    ! if you use such, so use with care!
    no scripting tcl init
    no scripting tcl encdir
    !
    ! Enable the netflow top talkers feature.
    ! You can see the top N talkers (50 in this example) with the
    show ip flow top-talkers command. This is a handy
    ! utility to use during DDoS attacks and traffic issues. You
    ! can sort-by either packets or bytes, as you prefer.
    ip flow-top-talkers
     top 50
     sort-by packets
    !
    ! Don't run the HTTP server.
    no ip http serverno ip http secure-server!
    ! Allow us to use the low subnet and go classless
    ip subnet-zeroip classless!
    ! Disable noxious services
    no service padno ip source-routeno ip fingerno ip bootp serverno ip domain-lookup!
    ! Block brute force login attempts while maintaining access for legitimate source addresses.
    http://www.cisco.com/en/US/docs/ios/sec_user_services/configuration/guide/sec_login_enhance_ps6922_TSD_Products_Configuration_Guide_Chapter.html
    ! This is in theory unnecessary if VTY ACLs are in place, yet things happen and this adds the
    ! "belt" to the VTY ACL "suspenders."
    ! Note carefully the use of ACL 100 in the login quiet-mode statement. This ensures our
    ! legitimate administrator addresses can still reach the router even after a vigorous
    ! bruteforce or attack attempt.
    login block-for 100 attempts 15 within 100login quiet-mode access-class 100login on-failure loglogin on-success log!
    ! Catch crash dumps; very important with a "security router."
    ip ftp username rooterip ftp password <PASSWORD>! Give our core dump files a unique name.
    exception core-file secure-router01-coreexception protocol ftpexception dump 192.0.2.34!
    ! Fire up CEF for both performance and security.
    ip cef!
    ! Set the timezone properly. It is best to standardize on one
    ! timezone for all routers, thus making problem tracking easier.
    clock timezone GMT 0! Synchronize our clocks with a local (trusted and authenticated)
    ! NTP server. The SECRETKEY must be the same on both the router
    ! and the NTP server.
    ntp authentication-key 6767 md5 <SECRETKEY>ntp authenticatentp update-calendarntp server 192.0.2.34!
    ! Configure the loopback0 interface as the source of our log
    ! messages. This is often used for routing protocols as well.
    ! Select an IP address that uniquely identifies this router.
    ! One trick is to allocate a netblock for use as the router
    ! loopback netblock.
    int loopback0 ip address 10.10.10.10 255.255.255.255 no ip redirects no ip unreachables no ip proxy-arp!
    ! Configure null0 as a place to send naughty packets. This
    ! becomes the "roach motel" for packets -- they can route in,
    ! but they can't route out.
    interface null0 no ip unreachables!
    interface Ethernet2/0 description Unprotected interface, facing towards Internet ip address 192.0.2.14 255.255.255.240 ! Do we run CEF verify? Yes if the data path is symmetric. No
     ! if the data path is asymmetric.
     ip verify unicast reverse-path ! Apply our template ACL
     ip access-group 2010 in ! Allow UDP to occupy no more than 2 Mb/s of the pipe.
     rate-limit input access-group 150 2010000 250000 250000 conform-action transmit exceed-action drop ! Allow ICMP to occupy no more than 500 Kb/s of the pipe.
     rate-limit input access-group 160 500000 62500 62500 conform-action transmit exceed-action drop ! Allow multicast to occupy no more than 5 Mb/s of the pipe.
     rate-limit input access-group 170 5000000 375000 375000 conform-action transmit exceed-action drop ! Don't send redirects.
     no ip redirects ! Don't send unreachables.
     ! NOTE WELL that this may break PMTU discovery.
     ! For example, if this router is edge for a VPN of any sort, you might need
     ! to enable ip unreachables
     ! A typical symptom is ping working but a larger transmission doesn't.
     no ip unreachables ! Don't propogate smurf attacks.
     no ip directed-broadcast ! Don't pretend to be something you're not. :-)
     no ip proxy-arp ! Do not reveal our netmask
     no ip mask-reply ! Log all naughty business.
     ip accounting access-violations ! If you allow multicast in your network or participate in the
     ! MBONE, the following multicast filtering steps will help to
     ! ensure a secure multicast environment. These must be applied
     ! per interface.
     ip multicast boundary 30 !
     ! Keep flow data for analysis. If possible, export it to a
     ! cflowd server.
     ip route-cache flow!
    interface Ethernet2/1 description Protected interface, facing towards DMZ ip address 192.0.2.17 255.255.255.240 ! Do we run CEF verify? Yes if the data path is symmetric. No
     ! if the data path is asymmetric.
     ip verify unicast reverse-path ! If we are using RPF, comment out the ACL below.
     ip access-group 115 in no ip redirects no ip unreachables no ip directed-broadcast no ip proxy-arp ip accounting access-violations ip multicast boundary 30 no ip mask-reply ip route-cache flow!
    ! Default route to the Internet (could be a routing
    ! protocol instead)
    ip route 0.0.0.0 0.0.0.0 192.0.2.1! Route to network on the other side of the firewall
    ip route 192.0.2.32 255.255.255.224 192.0.2.30! Black hole routes. Do not combine this with TCP Intercept;
    ! in fact, don't use TCP Intercept at all.
    !
    ! Bogons
    ! Team Cymru has removed all static bogon references from this template
    ! due to the high probability that the application of these bogon filters
    ! will be a one-time event. Unfortunately many of these templates are
    ! applied and never re-visited, despite our dire warnings that bogons do
    ! change.
    !
    ! This doesn't mean bogon filtering can't be accomplished in an automated
    ! manner. Why not consider peering with our globally distributed bogon
    ! route-server project? Alternately you can obtain a current and well
    ! maintained bogon feed from our DNS and RADb services. Read more at the
    ! link below to learn how!
    !
    https://www.team-cymru.org/Services/Bogons/
    !
    ! Export our NetFlow data to our NetFlow server, 192.0.2.34. NetFlow
    ! provides some statistics that can be of use when tracing the true
    ! source of a spoofed attack.
    ip flow-export source loopback0ip flow-export destination 192.0.2.34 2055ip flow-export version 5 origin-as!
    ! Log anything interesting to the loghost. Capture all of
    ! the logging output with FACILITY LOCAL5.
    logging trap debugginglogging facility local5logging source-interface loopback0logging 192.0.2.34!
    ! With the ACLs, it is important to log the naughty folks.
    ! Thus, the implicit drop all ACL is replaced (augmented,
    ! actually) with an explicit drop all that logs the attempt.
    ! You may wish to keep a second list (e.g. 2011) that does not
    ! log. During an attack, the additional logging can impact the
    ! performance of the router. Simply copy and paste access-list 2010,
    ! remove the log-input keyword, and name it access-list 2011. Then
    ! when an attack rages, you can replace access-list 2010 on the
    ! Internet-facing interface with access-list 2011.
    !
    ! Block SNMP access to all but the loghost
    access-list 20 remark SNMP ACLaccess-list 20 permit 192.0.2.34access-list 20 deny any log!
    ! Multicast - filter out obviously naughty or needless traffic
    access-list 30 remark Multicast filtering ACL! Link local
    access-list 30 deny 224.0.0.0 0.0.0.255 log! Locally scoped
    access-list 30 deny 239.0.0.0 0.255.255.255 log! sgi-dogfight
    access-list 30 deny host 224.0.1.2 log! rwhod
    access-list 30 deny host 224.0.1.3 log! ms-srvloc
    access-list 30 deny host 224.0.1.22 log! ms-ds
    access-list 30 deny host 224.0.1.24 log! ms-servloc-da
    access-list 30 deny host 224.0.1.35 log! hp-device-disc
    access-list 30 deny host 224.0.1.60 log! Permit all other multicast traffic
    access-list 30 permit 224.0.0.0 15.255.255.255 log!
    ! Block access to all but the loghost and the firewall, and log any
    ! denied access attempts. This also serves to create an audit trail
    ! of all access to the router. Extended ACLs are used to log some
    ! additional data.
    access-list 100 remark VTY Access ACLaccess-list 100 permit tcp host 192.0.2.34 host 0.0.0.0 range 22 23 log-inputaccess-list 100 permit tcp host 192.0.2.30 host 0.0.0.0 range 22 23 log-inputaccess-list 100 deny ip any any log-input!
    ! Leave one VTY safe for access, just in case. The host
    ! 192.0.2.40 is a secure host in the NOC. If all the VTYs are
    ! occupied, this leaves one VTY available.
    access-list 105 remark VTY Access ACLaccess-list 105 permit tcp host 192.0.2.40 host 0.0.0.0 range 22 23 log-inputaccess-list 105 deny ip any any log-input!
    ! Configure an ACL that prevents spoofing from within our network.
    ! This ACL assumes that we need to access the Internet only from the
    ! 192.0.2.32/27 network. If you have additional networks behind
    ! 192.0.2.32/27, then add them into this ACL.
    access-list 115 remark Anti-spoofing ACL! First, allow our intranet to access the Internet.
    access-list 115 permit ip 192.0.2.32 0.0.0.31 any! Second, allow our firewall to access the Internet. This is useful
    ! for testing.
    access-list 115 permit ip host 192.0.2.30 any! Now log all other such attempts.
    access-list 115 deny ip any any log-input!
    ! Rate limit (CAR) ACLs for UDP, ICMP, and multicast.
    access-list 150 remark CAR-UDP ACLaccess-list 150 permit udp any anyaccess-list 160 remark CAR-ICMP ACLaccess-list 160 permit icmp any anyaccess-list 170 remark CAR-Multicast ACLaccess-list 170 permit ip any 224.0.0.0 15.255.255.255!
    ! Deny any packets from the RFC 1918, IANA reserved, test,
    ! multicast as a source, and loopback netblocks to block
    ! attacks from commonly spoofed IP addresses.
    access-list 2010 remark Anti-bogon ACL! Claims it came from the inside network, yet arrives on the
    ! outside (read: Internet) interface. Do not use this if CEF
    ! has been configured to take care of spoofing.
    ! access-list 2010 deny ip 192.0.2.16 0.0.0.15 any log-input! access-list 2010 deny ip 192.0.2.32 0.0.0.31 any log-input!
    ! Bogons
    ! Team Cymru has removed all static bogon references from this template
    ! due to the high probability that the application of these bogon filters
    ! will be a one-time event. Unfortunately many of these templates are
    ! applied and never re-visited, despite our dire warnings that bogons do
    ! change.
    !
    ! This doesn't mean bogon filtering can't be accomplished in an automated
    ! manner. Why not consider peering with our globally distributed bogon
    ! route-server project? Alternately you can obtain a current and well
    ! maintained bogon feed from our DNS and RADb services. Read more at the
    ! link below to learn how!
    !
    https://www.team-cymru.org/Services/Bogons/
    !
    ! Drop all ICMP fragments
    access-list 2010 deny icmp any any fragments log-input! Allow IP access to the intranet (firewall filters specific ports)
    access-list 2010 permit ip any 192.0.2.32 0.0.0.31! Allow multicast to enter. See also access-list 30 for more
    ! specific multicast rules.
    access-list 2010 permit ip any 224.0.0.0 15.255.255.255! Our explicit (read: logged) drop all rule
    access-list 2010 deny ip any any log-input!
    ! Do not share CDP information, which contains key bits about our
    ! configuration, etc. This command disabled CDP globally. If you
    ! require CDP on an interface, use cdp run and disable cdp
    ! (no cdp enable) on the Internet-facing interface.
    no cdp run! SNMP is VERY important, particularly with MRTG.
    ! Treat the COMMUNITY string as a password - keep it difficult to guess.
    snmp-server community <COMMUNITY> RO 20!
    ! Introduce ourselves with an appropriately stern banner.
    banner motd %Router foo. Access to this device or the attachednetworks is prohibited without express written permission.Violators will be prosecuted to the fullest extent of both civiland criminal law.
    We don't like you. Go away.
    %!
    line con 0 exec-timeout 15 0 transport input noneline aux 0 exec-timeout 15 0line vty 0 3 access-class 100 in exec-timeout 15 0! Enable SSH connectivity.
    ! Obviously, you must have an IOS image that supports SSH, and don't
    ! forget to generate the key with crypto key generate rsa.
     transport input sshline vty 4 access-class 105 in exec-timeout 15 0 transport input ssh!
    ! End of the configuration.
    !



    Change Log

    Changes in version 6.4:
    • Removed telnet references
    • Added comment for service password-encryption
    • Added comments for use of secret instead of password
    Changes in version 6.3:
    • Added Login Block feature.
    • Cleaned up links, naming scheme, addresses.
    Changes in version 6.2:
    • Converted sample addresses to TEST-NET to make this doc RFC 3330-compliant.
    • Added Login Block feature.
    Changes in version 6.1:
    • Removed static bogon filters.
    Changes in version 6.0:
    • 109/8 and 178/8 allocated to RIPE (JAN 2009). Removed from the bogon filters.
    Changes in version 5.10:
    • 108/8 and 184/8 allocated to ARIN (Dec 2008). Removed from the bogon filters.
    Changes in version 5.9:
    • 110/8 and 111/8 allocated to APNIC (Nov 2008). Removed from the bogon filters.
    Changes in version 5.8:
    • Added in 198.18.0.0/15 added into the access-list and blackhole networks.
    Changes in version 5.7:
    • 110/8 and 111/8 allocated to APNIC (NOV 2008). Removed from the bogon filters.
    Changes in version 5.6:
    • 197/8 allocated to AFRINIC (OCT 2008). Removed from the bogon filters.
    Changes in version 5.5:
    • 112/8 and 113/8 allocated to APNIC (MAY 2008). Removed from the bogon filters.
    Changes in version 5.4:
    • Changed TCL wording.
    Changes in version 5.3:
    • 173/8 and 174/8 allocated to ARIN (FEB 2008). Removed from the bogon filters.
    Changes in version 5.2:
    • 14/8 changed to IANA Reserved (JAN 2008). Added to the bogon filters.
    Changes in version 5.1:
    • 114/8 and 115/8 allocated to APNIC (OCT 2007). Removed from the bogon filters.
    Changes in version 5.0:
    • 186/8 and 187/8 allocated to LACNIC (SEP 2007). Removed from the bogon filters.
    Changes in version 4.9:
    • Disabled TCL.
    • Added access and enable command logging.
    • Added the Netflow top talkers feature.
    Changes in version 4.8:
    • 94/8 and 95/8 allocated to RIPE (JUL 2007). Removed from the bogon filters.
    Changes in version 4.7:
    • 46/8 re-listed as IANA Reserved (APR 2007). Added to the bogon filters. 7/8 removed from bogon filters due to dispute in allocation status.
    Changes in version 4.6:
    • 92/8 and 93/8 allocated to RIPE (MAR 2007). Removed from the bogon filters.
    Changes in version 4.5:
    • 116/8, 117/8, 118/8, 119/8 and 120/8 allocated to APNIC (JAN 2007). Removed from the bogon filters.
    Changes in version 4.4:
    • 96/8, 97/8, 98/8 and 99/8 allocated to ARIN (OCT 2006). Removed from the bogon filters.
    Changes in version 4.3:
    • 77/8, 78/8 and 79/8 allocated to RIPE (AUG 2006). Removed from the bogon filters.
    Changes in version 4.2:
    • 121/8, 122/8 and 123/8 allocated to APNIC (JAN 2006). Removed from the bogon filters.
    Changes in version 4.1:
    • 89/8, 90/8 and 91/8 allocated to RIPE (JUN 2005). Removed from the bogon filters.
    Changes in version 4.0:
    • 74/8, 75/8 and 76/8 allocated to ARIN (JUN 2005). Removed from the bogon filters.
    • 189/8 and 190/8 allocated to LACNIC (JUN 2005). Removed from the bogon filters.
    Changes in version 3.9:
    • 41/8 allocated to AfriNIC (APR 2005). Removed from the bogon filters.
    Changes in version 3.8:
    • 73/8 allocated to ARIN (MAR 2005). Removed from the bogon filters.
    Changes in version 3.7:
    • 124/8, 125/8 and 126/8 allocated to APNIC (JAN 2005). Removed from the bogon filters.
    Changes in version 3.6:
    • 71/8 and 72/8 allocated to ARIN (AUG 2004). Removed from the bogon filters.
    Changes in version 3.5:
    • 58/8 and 59/8 allocated to the APNIC (APR 2004). Removed from the bogon filters.
    • Removed TCP Intercept, a feature best left disabled on all routers.
    Changes in version 3.4:
    • 85/8, 86/8, 87/8, and 88/8 allocated to the RIPE NCC (APR 2004). Removed from the bogon filters.
    Changes in version 3.3:
    • Removed 70/8 (allocated to ARIN JAN 2004) from the bogon filters.
    Changes in version 3.1:
    • Removed 83/8 and 84/8 (allocated to RIPE NCC NOV 2003) from the bogon filters.
    Changes in version 3.0:
    • APNIC returned the 223/8 allocation to IANA and received the 60/8 allocation in its place on 07 April 2003.
    Changes in version 2.9:
    • Added the following netblocks to the bogon filters, designated as RESERVED by IANA on 04 April 2003:
      173/8   Apr 03   IANA - Reserved
      174/8 Apr 03 IANA - Reserved
      175/8 Apr 03 IANA - Reserved
      176/8 Apr 03 IANA - Reserved
      177/8 Apr 03 IANA - Reserved
      178/8 Apr 03 IANA - Reserved
      179/8 Apr 03 IANA - Reserved
      180/8 Apr 03 IANA - Reserved
      181/8 Apr 03 IANA - Reserved
      182/8 Apr 03 IANA - Reserved
      183/8 Apr 03 IANA - Reserved
      184/8 Apr 03 IANA - Reserved
      185/8 Apr 03 IANA - Reserved
      186/8 Apr 03 IANA - Reserved
      187/8 Apr 03 IANA - Reserved
      189/8 Apr 03 IANA - Reserved
      190/8 Apr 03 IANA - Reserved
    Changes in version 2.8:
    • Removed 201/8 (allocated to LACNIC APR 2003) from the bogon filters.
    Changes in version 2.7:
    • Removed 222/8 and 223/8 (allocated to APNIC FEB 2003) from the bogon filters.
    Changes in version 2.6:
    • Removed 82/8 (allocated to RIPE NOV 2002) from the bogon filters.
    Changes in version 2.5:
    • Removed 69/8 (allocated to ARIN AUG 2002) from the bogon filters.
    Changes in version 2.3:
    • Added additional bogon filters to the black hole route list.
    • Added additional bogon filters to the ACLs.
    Changes on 22 JUN 2001 (version 2.3.1):
    • Removed 67/8 and 68/8 from the "bogon" ACLs. These netblocks will be allocated by ARIN (on /20 boundaries) as of 22 June 2001.
    Changes on 16 OCT 2001 (version 2.3.2):
    • Removed 219/8 from the "bogon" ACLs. This netblock will be allocated by APNIC as of 17 October 2001.
    Changes in version 2.4:
    • Removed 221/8 from the ACL and black hole route list. This netblock has been allocated to APNIC as of JUL 2002.

    Monday, May 13, 2013

    SNMP v3 Concept



    SNMPv3 protocol a security model, defining new concepts to replace the old community-based pseudo-authentication and provide communication privacy by means of encryption. The new concepts are: usergroupand security level. A group defines the access policy for a set of users. An access policy defines which SNMP objects can be accessed for reading and writing or which SNMP objects can generate notifications to the members of a group. Policy is defined by associating the respective read, write or notify view with a group. By using a notify view, a group determines the list of notifications its users can receive. A group also defines the security modeland security level for its users.
    Essentially, all groups form a table, which maps users to their read/write/notify views and security models. Note that if a group is defined without a read view than all objects are available to read. Contrary to that, if no write or notify view is defined, no write access is granted and no objects can send notifications to members of the group. The notify view is usually not configured manually. Rather, it’s added by the snmp-server host command automatically, when a users in a group is bound to a notification target host. Note that SNMP will use the username configured with snmp-server host along with the security model specified to authenticate and possibly encrypt the notifications. If the security model is set to «noauth» then a plain username is sent in a manner resembling the old community string.
    The following security models exist: SNMPv1, SNMPv2, SNMPv3. The following security levels exits: “noAuthNoPriv” (no authentiation and no encryption – noauth keyword in CLI), “AuthNoPriv” (messages are authenticated but not encrypted – auth keyword in CLI), “AuthPriv” (messages are authenticated and encrypted – priv keyword in CLI). SNMPv1 and SNMPv2 models only support the “noAuthNoPriv” model since they use plain community string to match the incoming packets. The SNMPv3 implementations could be configured to use either of the models on per-group basis (in case if “noAuthNoPriv” is configured, username serves as a replacement for community string). All users sharing a group utilize the same security model, however, the specific model settings (password, encryption key) are sep per-user. Note that SNMPv3 does not send passwords in clear-text and uses hash-based authentication with either MD5 or SHA1 functions (HMAC authentication – the packet conted is hashed along with authentication key to produce the authentication string). For encryption, statically configured keys are used along with DES56 symmetric cipher (that mean the same key should be configured on NMS for the particular user).
    Consider the example below. Three groups are created. Groups «NORMAL» and «RESTRICTED» are used to control remote users access and group «TRAP» is used to send notifications. Note that only read-view is specified for group “RESTRICTED” and it’s limited to IfEntry fields for a fixed interface index. The group «RESTRICTED» has an access-list applied to control the NMS stations the users can access from. Note that the groups have different security levels. Next, three users are created, one for each group respectively, with their authentication and encryption keys. Finally, SNMP link up and down notifications are enabled and SNMP trap destination host is configured. This operation automatically creates and assigns the «notify» view for the respective group (will appear in show commands output below).
    !
    ! Access-List to control users in the RESTRICTED group.
    !
    access-list 99 permit 155.1.146.0 0.0.0.255

    !
    ! Set ifIndexes persistent, for view definition is based on IfIndexes
    !
    snmp-server ifindex persist

    !
    ! The first view covers the “ISO” sub-branch and the second one covers
    ! all “lifEntry” fields for interface with IfIndex 3 (Serial 0/0).
    !
    snmp-server view NORMAL iso included
    snmp-server view RESTRICTED ifEntry.*.3 included

    !
    ! Define three groups. The first one allows to read and write
    ! into a large portion of the MIB tree. The second one allows reading
    ! just information specific to Serial 0/0 interface, and limits user
    ! access based on access-list
    !
    ! The third group is for sending traps. A user belonging to this group
    ! will be utilized to send trap messages. Its name and password
    ! will be used to create authentication credentials in a trap message
    ! and the users privacy password will be used to encrypt the packet.
    ! Note that this group has NO notify view defined, which is done on
    ! on purpose. The notify view will be automatically populated when
    ! notification hosts are configured and bound to users
    !

    snmp-server group NORMAL v3 priv read NORMAL write NORMAL
    snmp-server group RESTRICTED v3 auth read RESTRICTED access 99
    snmp-server group TRAP v3 priv

    !
    ! Users, their passwords and encryption keys are defined now
    !
    snmp-server user NORMAL NORMAL v3 auth sha CISCO priv des56 CISCO
    snmp-server user RESTRICTED RESTRICTED v3 auth sha CISCO
    snmp-server user TRAP TRAP v3 auth sha CISCO priv des56 CISCO

    !
    ! Allow sending traps and configure a destination host. Note that when
    ! a host is configured and bound to SNMPv3 username, the corresponding
    ! group notify view is populated based on traps allowed for this
    ! particular destination. This is why it’s not required to configure
    ! the notify view for a group.
    !
    snmp-server enable traps snmp linkup linkdown
    snmp-server host 155.1.146.100 traps version 3 priv TRAP
    Perform some basic verifications next using the show commands. Note that SNMPv3 users do not appear in the running configuration for security reason (different management channel) but you can see some information usingshow snmp users command. Also, pay attention to the automatic view assigned to the “TRAP” group.
    Rack1R6#show snmp user 

    User name: TRAP
    Engine ID: 80000009030000119221DA80
    storage-type: nonvolatile active
    Authentication Protocol: SHA
    Privacy Protocol: DES
    Group-name: TRAP

    User name: NORMAL
    Engine ID: 80000009030000119221DA80
    storage-type: nonvolatile active
    Authentication Protocol: SHA
    Privacy Protocol: DES
    Group-name: NORMAL

    User name: RESTRICTED
    Engine ID: 80000009030000119221DA80
    storage-type: nonvolatile active
    Authentication Protocol: SHA
    Privacy Protocol: None
    Group-name: RESTRICTED

    Rack1R6#show snmp group
    groupname: ILMI security model:v1
    readview : *ilmi writeview: *ilmi
    notifyview:
    row status: active

    groupname: ILMI security model:v2c
    readview : *ilmi writeview: *ilmi
    notifyview:
    row status: active

    groupname: TRAP security model:v3 noauth
    readview : writeview:
    notifyview: *tv.FFFFFFFF.FFFFFFFF.FFFFFFFF0F
    row status: active

    groupname: TRAP security model:v3 priv
    readview : v1default writeview:
    notifyview:
    row status: active

    groupname: NORMAL security model:v3 priv
    readview : NORMAL writeview: NORMAL
    notifyview:
    row status: active

    groupname: RESTRICTED security model:v3 auth
    readview : RESTRICTED writeview:
    notifyview:
    row status: active access-list: 99

    Rack1R6#show snmp view
    *ilmi system - included permanent active
    *ilmi atmForumUni - included permanent active
    NORMAL iso - included nonvolatile active
    v1default iso - included permanent active
    v1default internet.6.3.15 - excluded permanent active
    v1default internet.6.3.16 - excluded permanent active
    v1default internet.6.3.18 - excluded permanent active
    v1default ciscoMgmt.394 - excluded permanent active
    v1default ciscoMgmt.395 - excluded permanent active
    v1default ciscoMgmt.399 - excluded permanent active
    v1default ciscoMgmt.400 - excluded permanent active
    RESTRICTED ifEntry.0.3 FF:EF included nonvolatile active
    *tv.FFFFFFFF.FFFFFFFF.FFFFFFFF0F iso.2.840.10036 - included volatile active
    *tv.FFFFFFFF.FFFFFFFF.FFFFFFFF0F internet - included volatile active
    ==========================================================================================


    Cisco Router SNMPv3 Configuration Sample & Guide



    !!!!SNMP access control to only allow desired hosts!!!!!
    ip access-list standard snmp-allow
    permit 10.214.102.0 0.0.0.255
    permit 172.16.202.0 0.0.0.7
    !
    !
    !!!!!! First you’d need to create a view!!!!!
    !A read or write view can be !configured with desired MIB access.  Then, such views are assigned
    !to snmpv3 grops. Below is a read only view that start from the
    ! root, ‘iso’, but excludes snmpUsmMIB, snmpVacmMIB, !snmpCommuityMIB for enhance security.  These MIB are
    !explained below.
    !
    snmp-server view ReadView-All iso included
    !!!!!!!Exclusion for better security!!!!!
    snmp-server view ReadView-All 1.3.6.1.6.3.18 excluded
    snmp-server view ReadView-All 1.3.6.1.6.3.16 excluded
    snmp-server view ReadView-All 1.3.6.1.6.3.15 excluded
    snmp-server view ReadView-All 1.3.6.1.2.1.4.21 excluded
    snmp-server view ReadView-All 1.3.6.1.2.1.4.22 excluded
    !
    !
    !Here’s a write view which can be modified as needed to include or
    !exclude MIBs
    snmp-server view WriteView-ALL iso included
    !!!!!!!!Exclusions for better security!!!!!
    snmp-server view WriteView-All 1.3.6.1.6.3.18 excluded
    snmp-server view WriteView-All 1.3.6.1.6.3.16 excluded
    snmp-server view WriteView-All 1.3.6.1.6.3.15 excluded
    snmp-server view WriteView-All 1.3.6.1.2.1.4.21 excluded
    snmp-server view WriteView-All 1.3.6.1.2.1.4.22 excluded
    !
    !
    !!! Read/ Write group with ACL restriction
    snmp-server group SNMPv3-RW v3 priv read ReadView-ALL write WriteView-ALL  access snmp-allow
    !
    !
    !!!! Read only group with ACL restriction
    snmp-server group SNMPv3-RO v3 priv read ReadView-ALL access snmp-allow
    !
    !
    !!!Username is NetServices-RW, group is SNMPv3-RW I used DES for !priv as it’s more widely supported
    snmp-server user NetServices-RW  SNMPv3-RW v3 auth sha youpassword priv des yourpassword
    !
    !
    !!!Username is NetServices-RO, group is SNMPv3-RO
    snmp-server user NetServices-RO SNMPv3-RO v3 auth sha yourpassword priv des yourpassword
    !
    !
    !!!Monitoriing host that received SNMP traps via the username
    !NetService-RO I created above; so it uses NetService-RO for
    !auth and priv purposes
    snmp-server host 10.10.10.10 trap version 3 priv NetService-RO
    !
    !
    !!!This Enables all traps; you could modify it
    snmp-server enable traps



    1. snmpUsmMIB: management information definition for SNMP user-based security model

    2. snmpVacmMIB: management information definition for View-based Access Controll model for SNMP

    3. snmpCommunityMIB: this module defines objects for backward compatibility with v1 and v2c.


    Sunday, May 12, 2013

    Windows 下利用 WinSCP 执行定期备份任务




    利用 WinSCP 来备份数据已经很常用了,只要有 Linux 的 SSH 账号即可,但是有的时候,备份工作是烦锁,周期,没有激情的,每次都利用 WinSCP 连接、备份,很是麻烦,而且也会遗忘。
    其实利用 WinSCP 中的 winscp.com 能做到在命令行下备份,然后利用批处理执行定期任务。
    在 WinSCP 中正常添加主机的 SSH 账号,并且定义好主机名,比如:XXX
    在 WinSCP 目录中创建批处理文件 BakDB.bat,内容如下:
    option batch on
    option confirm off
    open XXX
    call ./backup_mysql.sh
    get /backup/* D:\BakDB\
    exit
    call ./backup_mysql.sh 是执行备份数据库的 shell 脚本,执行完成后复制 backup 目录下的所有文件保存到 D 盘的 BakDB 文件夹中。
    将该批处理添加到计划任务中即可周期自动运行,亦可手动双击批处理图标来执行备份操作。

    Saturday, May 11, 2013

    iBGP next-hop-self Not Working


    I've made some tests on dynamips ( ios 12.4 ) and next-hop-self
    doesn't work for ibgp routes on route-reflectors. However this seems
    to be the correct behavior according to cisco and juniper :




    http://www.cisco.com/en/US/docs/ios/12_2s/feature/guide/fs_bgpnh.html :

    Do not use the neighbor next-hop-self command to modify the next hop
    attribute for a route reflector when this feature is enabled for a
    route reflector client. Using the neighbor next-hop-self command on
    the route reflector will modify next hop attributes only for routes
    that are learned from eBGP peers and not the intended routes that are
    being reflected from the route reflector clients. To modify the next
    hop attribute when reflecting a route, use an outbound route map.




    http://kb.juniper.net/index?page=content&id=KB12984&actp=LIST :

    This is expected behavior. When you use Next-hop self on RRs, the
    cause only affects the next hop of eBGP learned routes (i.e.
    non-reflected routes). A RR reflects the same gateway for IBGP routes
    to other IBGP peers that it learns from the orginiating IBGP peer.
    The next-hop can only be modified for a reflected route via an
    outbound route-map.

    Please refer to RFC 1966 section 8, as follows:

    ++++++++++++++++++++
    In some implementations, modification of the BGP path attribute,
    NEXT_HOP is possible. For example, there could be a need for a RR to
    modify NEXT_HOP for EBGP learned routes sent to its internal peers.
    However, it must not be possible for an RR to set on reflected IBGP
    routes as this breaks the basic principle of Route Reflection and will
    result in potential black holeing of traffic.
    ++++++++++++++++++++


    Sunday, May 5, 2013

    First Hop Redundancy protocol comparison (HSRP,VRRP,GLBP)

    ProtocolFeatures
    HSRP
    (Hot Standby Router protocol)
    VRRP
    (Virtual Redundancy Router Protocol)
    GLBP
    (Gateway Load Balancing Protocol)
    Router role- 1 active router.- 1 standby router.- 1 or more listening routers.- 1 master router.- 1 or more backup routers.- 1 AVG (Active Virtual Gateway).- up to 4 AVF routers on the group (Active Virtual Forwarder) passing traffic.- up to 1024 virtual routers (GLBP groups) per physical interface.
    - Use virtual ip address.- Can use real router ip address, if not, the one with highest priority become master.- Use virtual ip address.
    ScopeCisco proprietaryIEEE standardCisco proprietary
    ElectionActive Router:
    1-Highest Priority
    2-Highest IP (tiebreaker)
    Master Router: (*)
    1-Highest Priority
    2-Highest IP (tiebreaker)
    Active Virtual Gateway:
    1-Highest Priority
    2-Highest IP (tiebreaker)
    Optimization featuresTracking
    yes
    yes
    yes
    Preempt
    yes
    yes
    yes
    Timer adjustments
    yes
    yes
    yes
    Traffic type224.0.0.2 – udp 1985 (version1)
    224.0.0.102-udp 1985 (version2)
    224.0.0.18 – IP 112224.0.0.102 udp 3222
    TimersHello – 3 secondsAdvertisement – 1 secondHello – 3 seconds
    (Hold) 10 seconds(Master Down Interval)3 * Advertisement + skew time(Hold) 10 seconds
    (Skew time)(256-priority) / 256
    Load-balancing functionality- Multiple HSRP group per interface/SVI/routed int.- Multiple VRRP group per interface/SVI/routed int.Load-balancing oriented- Weighted algorithm.- Host-dependent algorithm.
    - Round-Robin algorithm (default).
    Requires appropriate distribution of Virtual GW IP per Clients for optimal load-balancing.(generally through DHCP)Requires appropriate distribution of Virtual GW IP per Clients for optimal load-balancing.(generally through DHCP)Clients are transparently updated with virtual MAC according to load-balancing algorithm through ARP requesting a unique virtual gateway.

    * If the group VRRP Virtual IP on the master (higher priority) is the real IP configured on a different VRRP (Backup with lower priority) IOS will manage to make the VRRP router with the real IP, the master, by setting its priority to 255, knowing that the configurable range is [1-254].

    Gaia SNMP Configuration


    CheckPoint Gaia SNMP configuration

    Here is an example of SNMPv3 configuration in CheckPoint Gaia Appliace:
    set snmp agent on
    set snmp contact "[email protected]"
    set snmp location "Middle of nowhere"
    add snmp address 123.34.56.78
    set snmp agent-version v3-Only
    add snmp usm user snmpv3user security-level authPriv auth-pass-phrase 111222333 privacy-pass-phrase 555666777
    To use less secure version of SNMP v1/v2 use following commands:
    set snmp agent on
    set snmp contact "[email protected]"
    set snmp location "Middle of nowhere"
    add snmp address 123.34.56.78
    set snmp agent-version any
    set snmp community snmpv2community read-only
    Replace 123.34.56.78 with Firewall’s interface IP which is going to answer the SNMP requests. This command may be omitted – then SNMP will listen on all interfaces.
    If you want to enable SNMPv3 only you might want to remove the default “public” community from configuration file, but after changing the agent-version to v3-Only the firewall will reject your command:
    delete snmp community public read-only
    NMSSNM0075 SNMP v3-Only does not accept community strings.
    To work around this issue, just execute:
    set snmp agent-version any
    delete snmp community public read-only
    set snmp agent-version v3-Only



    Just select SNMP menu item from System Management menu.
    SNMP Setting von Check Point GAIA WebUI
    SNMP Setting von Check Point GAIA WebUI
    Then check the box for enabling the SNMP Agent, check the box for all the interfaces where you want the SNMP Agent to listen and press Apply.

    Then configure your SNMP community as needed and press Apply under this section again.
     
    Don’t forget to create a rule to allow SNMP access to your Security Gateway in your security policy and install it to get SNMP data.

    If you don’t like the WebUI you might also configure the SNMP settings from the CLISH command line.

    set snmp agent on
    set snmp agent-version any
    set snmp community ThisIsSoSecret read-only
    add snmp address 192.168.1.1


    We most recent SNMP MIB can be found on a GAIA installation with R75.45 at/opt/CPshrd-R75.40/lib/snmp/chkpnt.mib
     





    Saturday, May 4, 2013

    用route-map进行双ISP接入,完美实现负载负载均衡相互备份和策略路由(原创)


    在本人上一篇文章用route-map进行双ISP接入,并实现负载负载均衡相互备份和策略路由里,其中有一点点不是非常完美的地方,当网关路由器接口出现问题可以正常切换,但是如果是ISP出现了问题,则会出现不能切换问题,要解决这个问题,我们需要利用思科ip sla工具才解决,ip sla简单工作原理就是利用某种协议测试对方网络设备的连通性,最常见是icmp协议,如果对方设备响应表示线路正常,路由生效,如果对方设备不响应表示线路不正常,路由失效。

    为了保证园区或企业内部连接到Internet网络的高可用性,通常我们会使用双线接入(比如:电信,网通两个ISP提供的网络)。并部署相关的策略,在一条线路失效后,能快速切换到另外一条可用线路。而且在双线都正常使用时,实现负载均衡。根据目前来讲,进行策略路由方法大概有几下几种:
    一、根据源地址策略路由
    二、根据目的地址策略路由
    三、根据源端口策略路由
    四、根据目的端口策略路由
    在实际工作环境中,特别是网吧,一般采用两条光纤接入,一条接电信光纤,一条接网通光纤,如采用方法一进行策略路由,明显有几个不好的弊端,负载不均衡,有可能导致一条光纤负载大,一条负载小,还会导致访问网站(或游戏)的速度不理想,明明网游服务器在网通,可是数据包却从电信光纤出口出去,导致访问速度下降。
    方法三和四都有缺陷。只有方法二是工程中常用的方案,我们需要的是当访问电信网站时从电信光纤接口出去,当访问网通网站时从网通光纤接口出去,如果电信光纤接口出现问题,就从网通光纤出口出去,反之溢然,达到一个备份效果。



    实验要求:
    一、内网1和内网2要访问电信网络时,走电信出口(S1/0口),实现策略路由,提高网速。
    二、内网1和内网2要访问网通网络时,走网通出口(S1/1口),实现策略路由,提高网速。
    三、当电信光纤出现问题时,内网1和内网2走网通出口,当电信光纤恢复正常时,走电信出口,以达到备份的目的。
    四、当网通光纤出现问题时,内网1和内网2走电信出口,当电信光纤恢复正常时,走网通出口,以达到备份的目的。







    网络接口以及IP地址配置具体看拓扑图,
    Isp1路由器是用来模拟电信,环回口用来模拟网段,网段有:20.20.10.0 20.20.20.0 20.20.30.0共三个网段。



    Isp2路由器是用来模拟网通,环回口用来模拟网段,网段有:220.220.1.0 220.220.2.0 220.220.3.0共三个网段。



    下面开始具体配置。
    ISP1(模拟电信路由器)配置:
    hostname isp1

    interface Loopback0

    ip address 20.20.10.1 255.255.255.0

    !

    interface Loopback1

    ip address 20.20.20.1 255.255.255.0

    !         

    interface Loopback2

    ip address 20.20.30.1 255.255.255.0

    !

    interface Serial0/0

    ip address 100.100.100.2 255.255.255.0

    serial restart-delay 0

    !

    interface Serial0/1

    ip address 60.0.0.1 255.255.255.0

    serial restart-delay 0

    router bgp 1

    bgp log-neighbor-changes

    network 20.20.10.0 mask 255.255.255.0

    network 20.20.20.0 mask 255.255.255.0

    network 20.20.30.0 mask 255.255.255.0

    network 60.0.0.0 mask 255.255.255.0

    network 100.100.100.0 mask 255.255.255.0

    neighbor 60.0.0.2 remote-as 2

    注:两个ISP之间采用BGP路由,电信BGP自治系统号为1,环回口用来模拟电信的各个网段。



    ISP2(模拟电信路由器)配置:
    hostname isp2

    interface Loopback0

    ip address 220.220.1.1 255.255.255.0

    !

    interface Loopback1

    ip address 220.220.2.1 255.255.255.0

    !         

    interface Loopback2

    ip address 220.220.3.1 255.255.255.0

    !

    interface Serial0/0

    ip address 200.200.200.2 255.255.255.0

    serial restart-delay 0

    !

    interface Serial0/1

    ip address 60.0.0.2 255.255.255.0

    serial restart-delay 0 

    router bgp 2

    bgp log-neighbor-changes

    network 64.0.0.0 mask 255.255.255.0

    network 200.200.200.0

    network 220.220.1.0

    network 220.220.2.0

    network 220.220.3.0

    neighbor 60.0.0.1 remote-as 1




    注:两个ISP之间采用BGP路由,网通BGP自治系统号为2,环回口用来模拟电信的各个网段。



    Lan1(内网1)配置:
    hostname lan1

    interface Ethernet0/0

    ip address 192.168.1.2 255.255.255.0

    ip route 0.0.0.0 0.0.0.0 192.168.1.1




    Lan2(内网2)配置:
    hostname lan1

    interface Ethernet0/0

    ip address 192.168.2.2 255.255.255.0

    ip route 0.0.0.0 0.0.0.0 192.168.2.1




    网关路由器基本配置:
    hostname nat

    interface Serial1/0

    ip address 100.100.100.1 255.255.255.0

    注:连接电信接口
    interface Serial1/1

    ip address 200.200.200.1 255.255.255.0

    注:连接网通接口
    interface Ethernet2/0

    ip address 192.168.1.1 255.255.255.0

    注:连接内网1接口
    interface Ethernet2/1

    ip address 192.168.2.1 255.255.255.0

    注:连接内网2接口
    ip route 0.0.0.0 0.0.0.0 100.100.100.2

    ip route 0.0.0.0 0.0.0.0 200.200.200.2




    下面是关键配置:
    ip access-list extended isp1

    permit ip any 20.20.10.0 0.0.0.255

    permit ip any 20.20.20.0 0.0.0.255

    permit ip any 20.20.30.0 0.0.0.255

    permit ip any 60.0.0.0 0.0.0.255

    permit ip any 100.100.100.0 0.0.0.255

    permit ip any 200.200.200.0 0.0.0.255

    注:名为ISP1的访问列表有两个作用:
    一、把去往电信方向的网段挑选出来,等下NAT会调用,去往电信方向NAT就会转换公网地址为100.100.100.1
    二、策略路由时调用,去往电信方向,指出他的下一跳是电信出口。
    ip access-list extended isp2

    permit ip any 220.220.1.0 0.0.0.255

    permit ip any 220.220.2.0 0.0.0.255

    permit ip any 220.220.3.0 0.0.0.255

    permit ip any 60.0.0.0 0.0.0.255

    permit ip any 100.100.100.0 0.0.0.255

    permit ip any 200.200.200.0 0.0.0.255




    注:名为ISP2的访问列表有两个作用:
    一、把去往网通方向的网段挑选出来,等下NAT会调用,去往电信方向NAT就会转换公网地址为200.200.200.1
    二、策略路由时调用,去往网通方向,指出他的下一跳是网通出口。

    Ip sla配置部分,ip sla主要用来判断去往电信或网通的线路有没有出现问题,ip sla会每隔秒钟去ping一下网关地址,如果发现ping不通,则判断该线路有问题,数据包就会另外一条线路出去,达到一种自动切换的功能。
    ip sla 1

    icmp-echo 100.100.100.2 source-ip 100.100.100.1

    注:用网关路由器S1/0所在接口(电信接口)IP地址去ping其电信网关IP地址

    frequency 5

    注:ping的时间间隔为5秒钟一次。
    ip sla schedule 1 life forever start-time now
    注:计划调度时间为从现在开始的每一天。
    ip sla 2

    icmp-echo 200.200.200.2 source-ip 200.200.200.1

    注:用网关路由器S1/1所在接口(网通接口)IP地址去ping其网通网关IP地址

    frequency 5

    注:ping的时间间隔为5秒钟一次。
    ip sla schedule 2 life forever start-time now
    注:计划调度时间为从现在开始的每一天。
    track 1 rtr 1 reachability
    注:追踪去往电信线路的可达性
    track 2 rtr 2 reachability
    注:追踪去往网通线路的可达性
    route-map load permit 10

    match ip address isp1

    set ip next-hop verify-availability 100.100.100.2 1 track 1

    set ip next-hop verify-availability 200.200.200.2 2 track 2
    注:策略路由名为load,track 1 匹配去往电信网段的,设置下一跳为电信网关并追踪其可达性,如果可达,这条语句生效,不可达,则不生效,并执行下一语句。
    Track 2设置下一跳为网通网关并追踪其可达性,如果可达,这条语句生效,不可达,则不生效,并执行下一语句。注意编号的顺号。
    route-map load permit 20

    match ip address isp2

    set ip next-hop verify-availability 200.200.200.2 1 track 2

    set ip next-hop verify-availability 100.100.100.2 2 track 1
    注: track 2 匹配去往网通网段的,设置下一跳为网通网关并追踪其可达性,如果可达,这条语句生效,不可达,则不生效,并执行下一语句。
    Track 1设置下一跳为电信网关并追踪其可达性,如果可达,这条语句生效,不可达,则不生效,并执行下一语句。


    route-map load permit 30

    set ip next-hop verify-availability 100.100.100.2 1 track 1

    set ip next-hop verify-availability 200.200.200.2 2 track 2 
    注:这条语句可以不要,主要意思就是去往非电信和网通的数据包优先从电信接口出去,如果线路有问题,就从网通接口出去。



    route-map nat1 permit 10

    match ip address isp1

    match interface Serial1/0




    注:即要匹配去往电信的地址段,也要匹配出口为S1/0口(电信出口)。同时满足这两个条件,就给它做nat转换。



    route-map nat11 permit 10

    match ip address isp1

    match interface Serial1/1




    注:即要匹配去往电信的地址段,也要匹配出口为S1/1口(网通出口)。同时满足这两个条件,就给它做nat转换。这条语句主要是做备份用的,当s1/0DOWN掉时,这里就只有s1/1口可以用。



    route-map nat2 permit 10

    match ip address isp2

    match interface Serial1/1




    注:即要匹配去往网通的地址段,也要匹配出口为S1/1口(网通出口)。同时满足这两个条件,就给它做nat转换。



    route-map nat22 permit 10

    match ip address isp2

    match interface Serial1/0




    注:即要匹配去往网通的地址段,也要匹配出口为S1/0口(电信出口)。同时满足这两个条件,就给它做nat转换。这条语句主要是做备份用的,当s1/1DOWN掉时,这里就只有s1/0口可以用。






    route-map isp3 permit 10

    match ip address 1

    match interface Serial1/0




    注:如果要是访问即不是网通,也不是电信网段时, nat转换接口为s1/0(电信接口)。主语句,该语句可以不要。



    route-map isp33 permit 10

    match ip address 1

    match interface Serial1/1




    注:如果要是访问即不是网通,也不是电信网段时, nat转换接口为s1/1(网通接口),用来备份,默认是从电信出去,如果电信DOWN掉,这里只有从s1/1地址转换。该语句可以不要。



    interface Serial1/0

    ip nat outside




    interface Serial1/1

    ip nat outside




    interface Ethernet2/0

    ip nat inside

    ip policy route-map load

    interface Ethernet2/1

    ip nat inside

    ip policy route-map load




    注:在接口上应用策略路由。



    ip nat inside source route-map nat1 interface Serial1/0 overload

    注:如果是去往电信网段,转换出口为s1/0口(电信接口),正常去往电信时就拿S1/0公网地址进行转换。



    ip nat inside source route-map nat11 interface Serial1/1 overload

    注:如果是去往电信网段,转换出口为s1/1口(网通接口),作用就是当去往电信网段主接口s1/0 down掉,这时只有拿s1/1接口(网通接口)的公网地址进行转换。



    ip nat inside source route-map nat2 interface Serial1/1 overload

    注:如果是去往网通网段,转换出口为s1/1口(网通接口)正常去往网通时就拿S0/1公网地址进行转换。



    ip nat inside source route-map nat22 interface Serial1/0 overload




    注:如果是去往网通网段,转换出口为s1/0口(电信接口),作用就是当去往网通网段主接口s1/1 down掉,这时只有拿s1/0接口(电信接口)的公网地址进行转换。



    ip nat inside source route-map isp3 interface Serial1/0 overload

    注:如果访问的网段即不是电信,也不是网通,这时默认拿S1/0电信接口的公网地址进行转换。该语句可以不要。



    ip nat inside source route-map ips33 interface Serial1/1 overload

    注:如果访问的网段即不是电信,也不是网通,而且S1/0电信接口又DOWN掉时,只有拿S1/1网通接口的公网地址进行转换。该语句可以不要。



    打开debug ip nat观看nat转换效果:
    先在内网上ping电信的公网地址,可以看到,可以连接。
    lan1#ping 20.20.20.1                                                        




    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 20.20.20.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 12/40/64 ms

    lan1#ping 20.20.10.1




    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 20.20.10.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 8/24/44 ms

    lan1#ping 20.20.30.1




    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 20.20.30.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 8/23/44 m




    在网关上看一下nat有没有正确转换:

    01:25:47: NAT: s=192.168.1.2->100.100.100.1, d=20.20.20.1 [309]

    01:25:47: NAT*: s=20.20.20.1, d=100.100.100.1->192.168.1.2 [309]

    01:25:47: NAT: s=192.168.1.2->100.100.100.1, d=20.20.20.1 [310]

    01:25:47: NAT*: s=20.20.20.1, d=100.100.100.1->192.168.1.2 [310]

    01:25:47: NAT: s=192.168.1.2->100.100.100.1, d=20.20.20.1 [311]

    01:25:47: NAT*: s=20.20.20.1, d=100.100.100.1->192.168.1.2 [311]

    01:25:47: NAT: s=192.168.1.2->100.100.100.1, d=20.20.20.1 [312]

    01:25:47: NAT*: s=20.20.20.1, d=100.100.100.1->192.168.1.2 [312]

    01:25:47: NAT: s=192.168.1.2->100.100.100.1, d=20.20.20.1 [313]

    01:25:47: NAT*: s=20.20.20.1, d=100.100.100.1->192.168.1.2 [313]

    nat#

    01:25:52: NAT: s=192.168.1.2->100.100.100.1, d=20.20.10.1 [314]

    01:25:52: NAT*: s=20.20.10.1, d=100.100.100.1->192.168.1.2 [314]

    01:25:52: NAT: s=192.168.1.2->100.100.100.1, d=20.20.10.1 [315]

    01:25:52: NAT*: s=20.20.10.1, d=100.100.100.1->192.168.1.2 [315]

    01:25:52: NAT: s=192.168.1.2->100.100.100.1, d=20.20.10.1 [316]

    01:25:52: NAT*: s=20.20.10.1, d=100.100.100.1->192.168.1.2 [316]

    01:25:52: NAT: s=192.168.1.2->100.100.100.1, d=20.20.10.1 [317]

    01:25:52: NAT*: s=20.20.10.1, d=100.100.100.1->192.168.1.2 [317]

    01:25:52: NAT: s=192.168.1.2->100.100.100.1, d=20.20.10.1 [318]

    01:25:52: NAT*: s=20.20.10.1, d=100.100.100.1->192.168.1.2 [318]

    nat#

    01:25:56: NAT: s=192.168.1.2->100.100.100.1, d=20.20.30.1 [319]

    01:25:56: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [319]

    01:25:56: NAT: s=192.168.1.2->100.100.100.1, d=20.20.30.1 [320]

    01:25:56: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [320]

    01:25:56: NAT: s=192.168.1.2->100.100.100.1, d=20.20.30.1 [321]

    01:25:56: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [321]

    01:25:56: NAT: s=192.168.1.2->100.100.100.1, d=20.20.30.1 [322]

    01:25:56: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [322]

    01:25:56: NAT: s=192.168.1.2->100.100.100.1, d=20.20.30.1 [323]

    01:25:56: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [323]




    可以看出,去往电信网段时,NAT100.100.100.1这个电信的公网地址来转换,符合我们要求。



    下面在内网去ping网通的网段:
    lan1#ping 220.220.1.1




    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 220.220.1.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 12/28/44 ms

    lan1#ping 220.220.2.1




    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 220.220.2.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 4/28/68 ms

    lan1#ping 220.220.3.1




    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 220.220.3.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 16/46/64 ms

    可以连通。



    在网关看一下NAT转换情况:
    01:29:16: NAT: s=192.168.1.2->200.200.200.1, d=220.220.1.1 [324]

    01:29:16: NAT*: s=220.220.1.1, d=200.200.200.1->192.168.1.2 [324]

    01:29:16: NAT: s=192.168.1.2->200.200.200.1, d=220.220.1.1 [325]

    01:29:16: NAT*: s=220.220.1.1, d=200.200.200.1->192.168.1.2 [325]

    01:29:16: NAT: s=192.168.1.2->200.200.200.1, d=220.220.1.1 [326]

    01:29:16: NAT*: s=220.220.1.1, d=200.200.200.1->192.168.1.2 [326]

    01:29:16: NAT: s=192.168.1.2->200.200.200.1, d=220.220.1.1 [327]

    01:29:16: NAT*: s=220.220.1.1, d=200.200.200.1->192.168.1.2 [327]

    01:29:16: NAT: s=192.168.1.2->200.200.200.1, d=220.220.1.1 [328]

    01:29:16: NAT*: s=220.220.1.1, d=200.200.200.1->192.168.1.2 [328]

    nat#01:25:56: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [323]

    01:29:19: NAT: s=192.168.1.2->200.200.200.1, d=220.220.2.1 [329]

    01:29:19: NAT*: s=220.220.2.1, d=200.200.200.1->192.168.1.2 [329]

    01:29:19: NAT: s=192.168.1.2->200.200.200.1, d=220.220.2.1 [330]

    01:29:19: NAT*: s=220.220.2.1, d=200.200.200.1->192.168.1.2 [330]

    01:29:19: NAT: s=192.168.1.2->200.200.200.1, d=220.220.2.1 [331]

    01:29:19: NAT*: s=220.220.2.1, d=200.200.200.1->192.168.1.2 [331]

    01:29:19: NAT: s=192.168.1.2->200.200.200.1, d=220.220.2.1 [332]

    01:29:19: NAT*: s=220.220.2.1, d=200.200.200.1->192.168.1.2 [332]

    01:29:19: NAT: s=192.168.1.2->200.200.200.1, d=220.220.2.1 [333]

    01:29:19: NAT*: s=220.220.2.1, d=200.200.200.1->192.168.1.2 [333]

    nat#01:25:56: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [323]

    01:29:21: NAT: s=192.168.1.2->200.200.200.1, d=220.220.3.1 [334]

    01:29:21: NAT*: s=220.220.3.1, d=200.200.200.1->192.168.1.2 [334]

    01:29:22: NAT: s=192.168.1.2->200.200.200.1, d=220.220.3.1 [335]

    01:29:22: NAT*: s=220.220.3.1, d=200.200.200.1->192.168.1.2 [335]

    01:29:22: NAT: s=192.168.1.2->200.200.200.1, d=220.220.3.1 [336]

    01:29:22: NAT*: s=220.220.3.1, d=200.200.200.1->192.168.1.2 [336]

    01:29:22: NAT: s=192.168.1.2->200.200.200.1, d=220.220.3.1 [337]

    01:29:22: NAT*: s=220.220.3.1, d=200.200.200.1->192.168.1.2 [337]

    01:29:22: NAT: s=192.168.1.2->200.200.200.1, d=220.220.3.1 [338]

    01:29:22: NAT*: s=220.220.3.1, d=200.200.200.1->192.168.1.2 [338]

    可以看出,网关是拿网通接口的公网地址200.200.200.1拿进行nat转换的,符合我们的要求。






    在网关上看一下NAT转换情况:
    01:37:10: NAT: s=192.168.1.2->100.100.100.1, d=6.6.6.6 [354]

    01:37:10: NAT*: s=6.6.6.6, d=100.100.100.1->192.168.1.2 [354]

    01:37:10: NAT: s=192.168.1.2->100.100.100.1, d=6.6.6.6 [355]

    01:37:10: NAT: s=200.200.200.2, d=100.100.100.1->192.168.1.2 [339]

    01:37:10: NAT: s=192.168.1.2->100.100.100.1, d=6.6.6.6 [356]

    01:37:10: NAT*: s=6.6.6.6, d=100.100.100.1->192.168.1.2 [356]

    01:37:10: NAT: s=192.168.1.2->100.100.100.1, d=6.6.6.6 [357]

    去往非电信网通网段时,拿电信的公网地址进行转换。



    下面我们把isp1路由器的S0/0接口关闭。这里通往电信的线路将不可达。
    Isp1(config)#int s0/0

    Isp1(config-if)#shutdown



    回到NAT路由器上PING电信网关:
    nat#ping 100.100.100.2
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 100.100.100.2, timeout is 2 seconds:
    .....
    Success rate is 0 percent (0/5)
    发现不通,因为isp1把S0/0口DOWN掉了
    回到内网上在去ping电信网段,看一下情况会是怎样。
    lan1#ping 20.20.10.1




    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 20.20.10.1, timeout is 2 seconds:

    !!.!!

    Success rate is 80 percent (4/5), round-trip min/avg/max = 24/47/92 ms

    lan1#ping 20.20.20.1 




    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 20.20.20.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 16/44/72 ms

    lan1#ping 20.20.30.1




    Type escape sequence to abort.

    Sending 5, 100-byte ICMP Echos to 20.20.30.1, timeout is 2 seconds:

    !!!!!

    Success rate is 100 percent (5/5), round-trip min/avg/max = 12/34/48 ms

    可以连通,因为数据包从网关的S1/1接口出去了,电信线路不通,没有对内网产生影响。



    在网关上看一下NAT转换情况:



    nat#

    01:42:01: NAT: s=192.168.1.2->200.200.200.1, d=20.20.10.1 [374]

    01:42:01: NAT*: s=20.20.10.1, d=200.200.200.1->192.168.1.2 [374]

    01:42:01: NAT: s=192.168.1.2->200.200.200.1, d=20.20.10.1 [375]

    01:42:01: NAT*: s=20.20.10.1, d=200.200.200.1->192.168.1.2 [375]

    01:42:01: NAT: s=192.168.1.2->200.200.200.1, d=20.20.10.1 [376]

    01:42:01: NAT*: s=20.20.10.1, d=200.200.200.1->192.168.1.2 [376]

    01:42:01: NAT: s=192.168.1.2->200.200.200.1, d=20.20.10.1 [377]

    01:42:01: NAT*: s=20.20.10.1, d=200.200.200.1->192.168.1.2 [377]

    01:42:01: NAT: s=192.168.1.2->200.200.200.1, d=20.20.10.1 [378]

    01:42:01: NAT*: s=20.20.10.1, d=200.200.200.1->192.168.1.2 [378]

    nat#

    01:42:05: NAT: s=192.168.1.2->200.200.200.1, d=20.20.20.1 [379]

    01:42:05: NAT*: s=20.20.20.1, d=200.200.200.1->192.168.1.2 [379]

    01:42:05: NAT: s=192.168.1.2->200.200.200.1, d=20.20.20.1 [380]

    01:42:05: NAT*: s=20.20.20.1, d=200.200.200.1->192.168.1.2 [380]

    01:42:05: NAT: s=192.168.1.2->200.200.200.1, d=20.20.20.1 [381]

    01:42:05: NAT*: s=20.20.20.1, d=200.200.200.1->192.168.1.2 [381]

    01:42:05: NAT: s=192.168.1.2->200.200.200.1, d=20.20.20.1 [382]

    01:42:05: NAT*: s=20.20.20.1, d=200.200.200.1->192.168.1.2 [382]

    01:42:05: NAT: s=192.168.1.2->200.200.200.1, d=20.20.20.1 [383]

    01:42:05: NAT*: s=20.20.20.1, d=200.200.200.1->192.168.1.2 [383]

    nat#

    01:42:08: NAT: s=192.168.1.2->200.200.200.1, d=20.20.30.1 [384]

    01:42:08: NAT*: s=20.20.30.1, d=200.200.200.1->192.168.1.2 [384]

    01:42:08: NAT: s=192.168.1.2->200.200.200.1, d=20.20.30.1 [385]

    01:42:08: NAT*: s=20.20.30.1, d=200.200.200.1->192.168.1.2 [385]

    01:42:08: NAT: s=192.168.1.2->200.200.200.1, d=20.20.30.1 [386]

    01:42:08: NAT*: s=20.20.30.1, d=200.200.200.1->192.168.1.2 [386]

    01:42:08: NAT: s=192.168.1.2->200.200.200.1, d=20.20.30.1 [387]

    01:42:08: NAT*: s=20.20.30.1, d=200.200.200.1->192.168.1.2 [387]

    01:42:08: NAT: s=192.168.1.2->200.200.200.1, d=20.20.30.1 [388]

    01:42:08: NAT*: s=20.20.30.1, d=200.200.200.1->192.168.1.2 [388]

    可以看到,当去往电信网段不通时,这里会拿S1/1网通接口的公网IP200.200.200.1地址来进行NAT转换。
    下面回到isp1路由器,把S0/0打开
    Isp1(config)#int s0/0

    Isp1(config-if)#no shutdown


    在网关路由器看一下NAT转换情况



    01:46:36: NAT: s=192.168.1.2->100.100.100.1, d=20.20.10.1 [409]

    01:46:36: NAT*: s=20.20.10.1, d=100.100.100.1->192.168.1.2 [409]

    01:46:36: NAT: s=192.168.1.2->100.100.100.1, d=20.20.10.1 [410]

    01:46:36: NAT*: s=20.20.10.1, d=100.100.100.1->192.168.1.2 [410]

    01:46:36: NAT: s=192.168.1.2->100.100.100.1, d=20.20.10.1 [411]

    01:46:36: NAT*: s=20.20.10.1, d=100.100.100.1->192.168.1.2 [411]

    01:46:36: NAT: s=192.168.1.2->100.100.100.1, d=20.20.10.1 [412]

    01:46:36: NAT*: s=20.20.10.1, d=100.100.100.1->192.168.1.2 [412]

    01:46:36: NAT: s=192.168.1.2->100.100.100.1, d=20.20.10.1 [413]

    01:46:36: NAT*: s=20.20.10.1, d=100.100.100.1->192.168.1.2 [413]

    nat#

    01:46:38: NAT: s=192.168.1.2->100.100.100.1, d=20.20.20.1 [414]

    01:46:38: NAT*: s=20.20.20.1, d=100.100.100.1->192.168.1.2 [414]

    01:46:38: NAT: s=192.168.1.2->100.100.100.1, d=20.20.20.1 [415]

    01:46:38: NAT*: s=20.20.20.1, d=100.100.100.1->192.168.1.2 [415]

    01:46:39: NAT: s=192.168.1.2->100.100.100.1, d=20.20.20.1 [416]

    01:46:39: NAT*: s=20.20.20.1, d=100.100.100.1->192.168.1.2 [416]

    01:46:39: NAT: s=192.168.1.2->100.100.100.1, d=20.20.20.1 [417]

    01:46:39: NAT*: s=20.20.20.1, d=100.100.100.1->192.168.1.2 [417]

    01:46:39: NAT: s=192.168.1.2->100.100.100.1, d=20.20.20.1 [418]

    01:46:39: NAT*: s=20.20.20.1, d=100.100.100.1->192.168.1.2 [418]

    nat#

    01:46:41: NAT: s=192.168.1.2->100.100.100.1, d=20.20.30.1 [419]

    01:46:41: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [419]

    01:46:41: NAT: s=192.168.1.2->100.100.100.1, d=20.20.30.1 [420]

    01:46:41: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [420]

    01:46:41: NAT: s=192.168.1.2->100.100.100.1, d=20.20.30.1 [421]

    01:46:41: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [421]

    01:46:41: NAT: s=192.168.1.2->100.100.100.1, d=20.20.30.1 [422]

    01:46:41: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [422]

    01:46:41: NAT: s=192.168.1.2->100.100.100.1, d=20.20.30.1 [423]

    01:46:41: NAT*: s=20.20.30.1, d=100.100.100.1->192.168.1.2 [423]

    可以看出,当去往电信网段正常时,isp1路由器S0/0口打开后,网关路由器又会拿S1/0电信接口的公网IP100.100.100.1地址来进行NAT转换。符合我们的要求。







    通过以上我们可以看出,我们已经实现本实验要求:
    1、内网1和内网2要访问电信网络时,走电信出口(S1/0口)。
    2、内网1和内网2要访问网通网络时,走网通出口(S1/1口)。
    3、当电信光纤出现问题时,内网1和内网2走网通出口,当电信光纤恢复正常时,走电信出口,以达到备份的目的。
    4、当网通光纤出现问题时,内网1和内网2走电信出口,当电信光纤恢复正常时,走网通出口,以达到备份的目的。



    在做双ISP接入实验时,主要要理解nat和策略路由这两个过程,第一要解决公网地址转换时的问题,因为双ISP接入时有两个公网地址,默认情况下只会有一个公网地址生效,解决这个问题需要用到route-map,一般我们在做nat时,我们会拿源地址时行转换。比如:
    nat(config)#access-list 1 permit 192.168.1.0

    nat(config)#ip nat inside source list 1 interface e0/0 overload

    像这样做,会出现只有一个公网地址生效。所以,我们要采用扩展ACL来做,把去往电信或网通的所以网段列表挑选出来,如果是去往电信,就拿电信的公网IP转换。是去往网通,就拿网通的公网IP转换。我们需要做的是收集大量的网通电信网段地址表,网络上可以下载到。
    解决了nat地址转换问题后,还要解决一个路由的问题,nat只是转换地址,没有说数据怎样出去。要我们需要策略路由,用route-map强行指定去往电信的数据包走电信接口。去往网通的数据包走网通接口。
    例:
    route-map load permit 10

    match ip address isp1

    set interface Serial0/0

    set default interface Serial0/1

    set default interface Serial0/1这语句非常有用,如果S0/0 DOWN时,就可以走默认出口S0/1,从而实现路由不会中断。个中好处可以自己体会。

    NAT路由器全配置:
    nat#sh run
    Building configuration...

    Current configuration : 3531 bytes
    !
    version 12.4
    service timestamps debug datetime msec
    service timestamps log datetime msec
    no service password-encryption
    !
    hostname nat
    !
    boot-start-marker
    boot-end-marker
    !
    !
    no aaa new-model
    ip cef
    !
    !
    !
    !
    no ip domain lookup
    !
    multilink bundle-name authenticated
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    !
    track 1 rtr 1 reachability
    !
    track 2 rtr 2 reachability

    !
    !
    !
    !
    !
    interface FastEthernet0/0

    no ip address


    shutdown


    duplex half

    !
    interface Serial1/0

    ip address 100.100.100.1 255.255.255.0


    ip nat outside


    ip virtual-reassembly


    serial restart-delay 0

    !
    interface Serial1/1

    ip address 200.200.200.1 255.255.255.0


    ip nat outside


    ip virtual-reassembly


    serial restart-delay 0

    !
    interface Serial1/2

    no ip address


    shutdown


    serial restart-delay 0

    !
    interface Serial1/3

    no ip address


    shutdown


    serial restart-delay 0

    !
    interface Ethernet2/0

    ip address 192.168.1.1 255.255.255.0


    ip nat inside


    ip virtual-reassembly


    ip policy route-map load


    duplex half

    !
    interface Ethernet2/1

    ip address 192.168.2.1 255.255.255.0


    ip nat inside


    ip virtual-reassembly


    ip policy route-map load


    duplex half

    !
    interface Ethernet2/2

    no ip address


    shutdown


    duplex half

    !
    interface Ethernet2/3

    no ip address


    shutdown


    duplex half

    !
    ip route 0.0.0.0 0.0.0.0 100.100.100.2
    ip route 0.0.0.0 0.0.0.0 200.200.200.2
    no ip http server
    no ip http secure-server
    !
    !
    ip nat inside source route-map ips33 interface Serial1/1 overload
    ip nat inside source route-map isp3 interface Serial1/0 overload
    ip nat inside source route-map nat1 interface Serial1/0 overload
    ip nat inside source route-map nat11 interface Serial1/1 overload
    ip nat inside source route-map nat2 interface Serial1/1 overload
    ip nat inside source route-map nat22 interface Serial1/0 overload
    !
    ip access-list extended isp1

    permit ip any 20.20.10.0 0.0.0.255


    permit ip any 20.20.20.0 0.0.0.255


    permit ip any 20.20.30.0 0.0.0.255


    permit ip any 60.0.0.0 0.0.0.255


    permit ip any 100.100.100.0 0.0.0.255


    permit ip any 200.200.200.0 0.0.0.255

    ip access-list extended isp2

    permit ip any 220.220.1.0 0.0.0.255


    permit ip any 220.220.2.0 0.0.0.255


    permit ip any 220.220.3.0 0.0.0.255


    permit ip any 60.0.0.0 0.0.0.255


    permit ip any 100.100.100.0 0.0.0.255


    permit ip any 200.200.200.0 0.0.0.255

    !
    ip sla 1

    icmp-echo 100.100.100.2 source-ip 100.100.100.1


    frequency 5

    ip sla schedule 1 life forever start-time now
    ip sla 2

    icmp-echo 200.200.200.2 source-ip 200.200.200.1


    frequency 5

    ip sla schedule 2 life forever start-time now
    logging alarm informational
    !
    !
    route-map load permit 10

    match ip address isp1


    set ip next-hop verify-availability 100.100.100.2 1 track 1


    set ip next-hop verify-availability 200.200.200.2 2 track 2

    !
    route-map load permit 20

    match ip address isp2


    set ip next-hop verify-availability 200.200.200.2 1 track 2


    set ip next-hop verify-availability 100.100.100.2 2 track 1

    !
    route-map load permit 30

    set ip next-hop verify-availability 100.100.100.2 1 track 1


    set ip next-hop verify-availability 200.200.200.2 2 track 2

    !
    route-map nat2 permit 10

    match ip address isp2


    match interface Serial1/1

    !
    route-map nat1 permit 10

    match ip address isp1


    match interface Serial1/0

    !
    route-map isp3 permit 10

    match ip address 1

    !
    route-map nat11 permit 10

    match ip address isp1


    match interface Serial1/1

    !
    route-map nat22 permit 10

    match ip address isp2


    match interface Serial1/0

    !
    !
    !
    !
    control-plane
    !
    !
    !
    !
    !
    !
    gatekeeper

    shutdown

    !
    !
    line con 0

    exec-timeout 0 0


    logging synchronous


    stopbits 1

    line aux 0

    stopbits 1

    line vty 0 4
    !
    !
    end

    YouTube Channel