cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4238
Views
5
Helpful
1
Replies

Export NAT Table

dears,

 

how can i export nat table to Excel or Access file

i need to export tha table to any thing can save tha table entries :)

 

Thanks 

1 Accepted Solution

Accepted Solutions

Peter Paluch
Cisco Employee
Cisco Employee

Mustafa,

I do not believe there is an immediately ready tool to do this. However, if you have a Linux machine anywhere nearby, you could do something similar to this:

  1. Using any familiar terminal, capture the output of the show ip nat tran into a text file (use terminal length 0 to allow the router to list all NAT entries in a single pass without paginating the output). Delete the first line with the column headings and leave only the NAT entries in the file. Transfer the file to the Linux machine.
  2. Assuming the file is called nat.txt, issue the following command on the Linux machine:

    sed -r s/" "+/,/g nat.txt > nat.csv
     
  3. This command will collapse all successive whitespaces in a line into a single comma character. As a result, the listing of NAT entries will be processed into a CSV file called nat.csv. This CSV file should then be transferred back to any machine that has Excel or LibreOffice capable of importing CSV files. Remember, you have deleted the first line with column headings so the file will lack this description but you can always add it later in the Excel, and the order of fields is Protocol, InsideGlobal, InsideLocal, OutsideLocal, OutsideGlobal.

I hope this helps although it is a little "hackish"...

Best regards,
Peter

View solution in original post

1 Reply 1

Peter Paluch
Cisco Employee
Cisco Employee

Mustafa,

I do not believe there is an immediately ready tool to do this. However, if you have a Linux machine anywhere nearby, you could do something similar to this:

  1. Using any familiar terminal, capture the output of the show ip nat tran into a text file (use terminal length 0 to allow the router to list all NAT entries in a single pass without paginating the output). Delete the first line with the column headings and leave only the NAT entries in the file. Transfer the file to the Linux machine.
  2. Assuming the file is called nat.txt, issue the following command on the Linux machine:

    sed -r s/" "+/,/g nat.txt > nat.csv
     
  3. This command will collapse all successive whitespaces in a line into a single comma character. As a result, the listing of NAT entries will be processed into a CSV file called nat.csv. This CSV file should then be transferred back to any machine that has Excel or LibreOffice capable of importing CSV files. Remember, you have deleted the first line with column headings so the file will lack this description but you can always add it later in the Excel, and the order of fields is Protocol, InsideGlobal, InsideLocal, OutsideLocal, OutsideGlobal.

I hope this helps although it is a little "hackish"...

Best regards,
Peter

Review Cisco Networking for a $25 gift card