Discussion:
[rancid] cisco-xr ASR9K and numbered ACL's
Jos
2014-10-14 23:33:37 UTC
Permalink
Hi

Am new to this list and hoping someone can help me with a problem please
that I can’t figure out yet or find an earlier posting and solution for.
We are running the latest rancid version 3.1 on a centos vm and collecting
a bunch of cisco configs, all is good except for our iosxr ASR9K’s and
numbered ACL’s.
Rancid seems to strip out part of the lines as below:

Real config:
ipv4 access-list no-rfc1918

10 remark Deny traffic to RFC 1918
20 deny ipv4 10.0.0.0/8 any
30 deny ipv4 any 10.0.0.0/8
40 deny ipv4 172.16.0.0/12 any
50 deny ipv4 any 172.16.0.0/12
60 deny ipv4 192.168.0.0/16 any
70 deny ipv4 any 192.168.0.0/16
80 permit ipv4 any any


Rancid collected config:
ipv4 access-list no-rfc1918
remark Deny traffic to RFC 1918
deny ipv4 10.0.0.0/8 any
deny ipv4 any 10
deny ipv4 172.16.0.0/12 any
deny ipv4 any 172
deny ipv4 192.168.0.0/16 any
deny ipv4 any 192
permit ipv4 any any


A minor problem where the ACL is obvious as above, but this is the
exception.
Can someone suggest a good fix or workaround for this please (preferably
without changing the ASR9K config), I trust it affects others with this
sort of config?
I can see earlier posts mention xrrancid but can’t find that in our 3.1
install.

Regards,
Jos
Alan McKinnon
2014-10-15 05:22:23 UTC
Permalink
Post by Jos
Hi
Am new to this list and hoping someone can help me with a problem please
that I can’t figure out yet or find an earlier posting and solution for.
We are running the latest rancid version 3.1 on a centos vm and collecting
a bunch of cisco configs, all is good except for our iosxr ASR9K’s and
numbered ACL’s.
ipv4 access-list no-rfc1918
10 remark Deny traffic to RFC 1918
20 deny ipv4 10.0.0.0/8 any
30 deny ipv4 any 10.0.0.0/8
40 deny ipv4 172.16.0.0/12 any
50 deny ipv4 any 172.16.0.0/12
60 deny ipv4 192.168.0.0/16 any
70 deny ipv4 any 192.168.0.0/16
80 permit ipv4 any any
ipv4 access-list no-rfc1918
remark Deny traffic to RFC 1918
deny ipv4 10.0.0.0/8 any
deny ipv4 any 10
deny ipv4 172.16.0.0/12 any
deny ipv4 any 172
deny ipv4 192.168.0.0/16 any
deny ipv4 any 192
permit ipv4 any any
A minor problem where the ACL is obvious as above, but this is the
exception.
Can someone suggest a good fix or workaround for this please (preferably
without changing the ASR9K config), I trust it affects others with this
sort of config?
I can see earlier posts mention xrrancid but can’t find that in our 3.1
install.
This appears to be rancid's acl renumbering, which is the designed
behaviour for good reasons.

Access list numbers are problematic as they are subject to being
renumbered when the device reloads the list. However, all that changes
is the interval between numbers, the logic of what the li8st achieves
stays the same. This causes unnecessary noise in the diffs as there
isn't an actual change, just a change of a bunch of redundant leading
numbers.

Rancid's solution is to strip out the numbers, gather contiguous series
of allows or denies and reorder those based on IP addresses. This works
because if you have 5 denys in a row affecting different ranges, it does
not matter what order they are applied in. Thus the router can renumber
ACLs all it likes and the rancid diff does not change, reducing noise.


I don't know about 3.2 but the 2.3 series had a knob to disable this. If
memory serves it was called ACL_SORT and is documented in the config
file. The topic has also been discussed at length here on the list
before, you can find the threads in the on-line archives, there's more
info there than I can give in one shortish reply.
--
Alan McKinnon
***@gmail.com
heasley
2014-10-15 05:27:02 UTC
Permalink
Post by Alan McKinnon
Post by Jos
ipv4 access-list no-rfc1918
remark Deny traffic to RFC 1918
deny ipv4 10.0.0.0/8 any
deny ipv4 any 10
deny ipv4 172.16.0.0/12 any
deny ipv4 any 172
deny ipv4 192.168.0.0/16 any
deny ipv4 any 192
permit ipv4 any any
A minor problem where the ACL is obvious as above, but this is the
exception.
Can someone suggest a good fix or workaround for this please (preferably
without changing the ASR9K config), I trust it affects others with this
sort of config?
I can see earlier posts mention xrrancid but can’t find that in our 3.1
install.
This appears to be rancid's acl renumbering, which is the designed
behaviour for good reasons.
I dont think so; yes its removing the line numbers, but its botching every
other line.
Alan McKinnon
2014-10-15 05:28:52 UTC
Permalink
Post by heasley
Post by Alan McKinnon
Post by Jos
ipv4 access-list no-rfc1918
remark Deny traffic to RFC 1918
deny ipv4 10.0.0.0/8 any
deny ipv4 any 10
deny ipv4 172.16.0.0/12 any
deny ipv4 any 172
deny ipv4 192.168.0.0/16 any
deny ipv4 any 192
permit ipv4 any any
A minor problem where the ACL is obvious as above, but this is the
exception.
Can someone suggest a good fix or workaround for this please (preferably
without changing the ASR9K config), I trust it affects others with this
sort of config?
I can see earlier posts mention xrrancid but can’t find that in our 3.1
install.
This appears to be rancid's acl renumbering, which is the designed
behaviour for good reasons.
I dont think so; yes its removing the line numbers, but its botching every
other line.
Is "deny ipv4 any 192" a valid Cisco config?
--
Alan McKinnon
***@gmail.com
Jos
2014-10-15 07:59:08 UTC
Permalink
Hi Guys

Thanks to you both for the replies. I should have mentioned I’ve tried the
ACL-SORT option being disabled/enabled in config without seeing any
success, I had this line in rancid.conf:

# if ACLSORT is NO, access-lists will NOT be sorted.
ACLSORT=NO; export ACLSORT
#

I have tried removing “export ACLSORT” with no luck either.


I have 4 or 5 ASR9K’s running 4.3.x and all do the same thing. Perhaps a
better example is this one:

Rancid backs up this:
ipv4 access-list name
permit ipv4 any 166
remark the below subnet is currently not in use
permit ipv4 any 166

What we have configured is:
ipv4 access-list name
10 permit ipv4 any 166.1xx.xx.xx/28
20 remark the below subnet is currently not in use
30 permit ipv4 any 166.1xx.xx.xxx/28


- so the rancid backup leaves a bit to be desired here I think.

I have:
expect version 5.44.1.15
This is on centos 6.5, I had the packaged version of rancid installed, an
old 2.3.8 or something but then grabbed 3.1 and compiled it and have
removed the package.


Thanks for all your help with this, I can share more config if you let me
know what exactly.

Cheers, Jos
Post by heasley
Post by Jos
Post by Jos
ipv4 access-list no-rfc1918
remark Deny traffic to RFC 1918
deny ipv4 10.0.0.0/8 any
deny ipv4 any 10
deny ipv4 172.16.0.0/12 any
deny ipv4 any 172
deny ipv4 192.168.0.0/16 any
deny ipv4 any 192
permit ipv4 any any
A minor problem where the ACL is obvious as above, but this is the
exception.
Can someone suggest a good fix or workaround for this please
(preferably
Post by Jos
without changing the ASR9K config), I trust it affects others with
this
Post by Jos
sort of config?
I can see earlier posts mention xrrancid but can’t find that in our
3.1
Post by Jos
install.
This appears to be rancid's acl renumbering, which is the designed
behaviour for good reasons.
I dont think so; yes its removing the line numbers, but its botching every
other line.
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Alan McKinnon
2014-10-15 21:14:09 UTC
Permalink
Post by Jos
Hi Guys
Thanks to you both for the replies. I should have mentioned I’ve tried the
ACL-SORT option being disabled/enabled in config without seeing any
# if ACLSORT is NO, access-lists will NOT be sorted.
ACLSORT=NO; export ACLSORT
#
I have tried removing “export ACLSORT” with no luck either.
I have 4 or 5 ASR9K’s running 4.3.x and all do the same thing. Perhaps a
ipv4 access-list name
permit ipv4 any 166
remark the below subnet is currently not in use
permit ipv4 any 166
ipv4 access-list name
10 permit ipv4 any 166.1xx.xx.xx/28
20 remark the below subnet is currently not in use
30 permit ipv4 any 166.1xx.xx.xxx/28
- so the rancid backup leaves a bit to be desired here I think.
The truncated address is due to this code in WriteTerm():

if (/^ipv(4|6) access-list (\S+)\s*$/) {
...
while (<INPUT>) {
...
($seq, $cmd, $misc, $ip) = ($_ =~ /^\s+(\d+) (\w+) (.*\s)(\w+)/);
if ($cmd =~ /(permit|deny)/) {
ProcessHistory("ACL $nlri $key $cmd",
"$aclsort","$ip", " $cmd $misc$ip\n");
...
}
}


That final (\w+) stops at the first dot.

I'm no Cisco guru and don't know all the permutations of how XR lists
access-lists, but I imagine the address must be everything after
"ipv(4|6) any ", so the regex should probably become:


($_ =~ /^\s+(\d+) (\w+) (.*\s)(.*)/)


This is for 2.3.8 (I don't have a 3.x install to hand to check)
Post by Jos
expect version 5.44.1.15
This is on centos 6.5, I had the packaged version of rancid installed, an
old 2.3.8 or something but then grabbed 3.1 and compiled it and have
removed the package.
Thanks for all your help with this, I can share more config if you let me
know what exactly.
Cheers, Jos
Post by heasley
Post by Jos
Post by Jos
ipv4 access-list no-rfc1918
remark Deny traffic to RFC 1918
deny ipv4 10.0.0.0/8 any
deny ipv4 any 10
deny ipv4 172.16.0.0/12 any
deny ipv4 any 172
deny ipv4 192.168.0.0/16 any
deny ipv4 any 192
permit ipv4 any any
A minor problem where the ACL is obvious as above, but this is the
exception.
Can someone suggest a good fix or workaround for this please
(preferably
Post by Jos
without changing the ASR9K config), I trust it affects others with
this
Post by Jos
sort of config?
I can see earlier posts mention xrrancid but can’t find that in our
3.1
Post by Jos
install.
This appears to be rancid's acl renumbering, which is the designed
behaviour for good reasons.
I dont think so; yes its removing the line numbers, but its botching every
other line.
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
--
Alan McKinnon
***@gmail.com
Jos
2014-10-16 08:08:41 UTC
Permalink
Thanks Alan and all those offering help with this. Your suggestion Alan of
using “($_ =~ /^\s+(\d+) (\w+) (.*\s)(.*)/)” has worked for me, I have
extra line breaks between ACL entries, but the ACL’s hold all the key data
they should now so I’m happy.
In my 3.1 install I had to adjust /home/rancid/lib/rancid/iosxr.pm as
noted.
Not sure if this is a bug or not, should the ACLSORT=NO disable this
feature entirely?

Cheers, Jos
Post by Alan McKinnon
Post by Jos
Hi Guys
Thanks to you both for the replies. I should have mentioned I’ve tried the
ACL-SORT option being disabled/enabled in config without seeing any
# if ACLSORT is NO, access-lists will NOT be sorted.
ACLSORT=NO; export ACLSORT
#
I have tried removing “export ACLSORT” with no luck either.
I have 4 or 5 ASR9K’s running 4.3.x and all do the same thing. Perhaps a
ipv4 access-list name
permit ipv4 any 166
remark the below subnet is currently not in use
permit ipv4 any 166
ipv4 access-list name
10 permit ipv4 any 166.1xx.xx.xx/28
20 remark the below subnet is currently not in use
30 permit ipv4 any 166.1xx.xx.xxx/28
- so the rancid backup leaves a bit to be desired here I think.
if (/^ipv(4|6) access-list (\S+)\s*$/) {
...
while (<INPUT>) {
...
($seq, $cmd, $misc, $ip) = ($_ =~ /^\s+(\d+) (\w+) (.*\s)(\w+)/);
if ($cmd =~ /(permit|deny)/) {
ProcessHistory("ACL $nlri $key $cmd",
"$aclsort","$ip", " $cmd $misc$ip\n");
...
}
}
That final (\w+) stops at the first dot.
I'm no Cisco guru and don't know all the permutations of how XR lists
access-lists, but I imagine the address must be everything after
($_ =~ /^\s+(\d+) (\w+) (.*\s)(.*)/)
This is for 2.3.8 (I don't have a 3.x install to hand to check)
Post by Jos
expect version 5.44.1.15
This is on centos 6.5, I had the packaged version of rancid installed, an
old 2.3.8 or something but then grabbed 3.1 and compiled it and have
removed the package.
Thanks for all your help with this, I can share more config if you let me
know what exactly.
Cheers, Jos
Post by heasley
Post by Jos
Post by Jos
ipv4 access-list no-rfc1918
remark Deny traffic to RFC 1918
deny ipv4 10.0.0.0/8 any
deny ipv4 any 10
deny ipv4 172.16.0.0/12 any
deny ipv4 any 172
deny ipv4 192.168.0.0/16 any
deny ipv4 any 192
permit ipv4 any any
A minor problem where the ACL is obvious as above, but this is the
exception.
Can someone suggest a good fix or workaround for this please
(preferably
Post by Jos
without changing the ASR9K config), I trust it affects others with
this
Post by Jos
sort of config?
I can see earlier posts mention xrrancid but can’t find that in our
3.1
Post by Jos
install.
This appears to be rancid's acl renumbering, which is the designed
behaviour for good reasons.
I dont think so; yes its removing the line numbers, but its botching every
other line.
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
--
Alan McKinnon
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Peter Jackson
2014-10-15 20:52:40 UTC
Permalink
I looked over the script last night and I think the tail end of the lines are being dropped because the regex needs to be tweaked. \w in Perl regex doesn't match a period, does it? If not, then the regex matches only up to the first period in the IP address and that is why the rest of the line is dropped.

I will look again when I get a chance.
Post by Jos
Hi Guys
Thanks to you both for the replies. I should have mentioned I’ve tried the
ACL-SORT option being disabled/enabled in config without seeing any
# if ACLSORT is NO, access-lists will NOT be sorted.
ACLSORT=NO; export ACLSORT
#
I have tried removing “export ACLSORT” with no luck either.
I have 4 or 5 ASR9K’s running 4.3.x and all do the same thing. Perhaps a
ipv4 access-list name
permit ipv4 any 166
remark the below subnet is currently not in use
permit ipv4 any 166
ipv4 access-list name
10 permit ipv4 any 166.1xx.xx.xx/28
20 remark the below subnet is currently not in use
30 permit ipv4 any 166.1xx.xx.xxx/28
- so the rancid backup leaves a bit to be desired here I think.
expect version 5.44.1.15
This is on centos 6.5, I had the packaged version of rancid installed, an
old 2.3.8 or something but then grabbed 3.1 and compiled it and have
removed the package.
Thanks for all your help with this, I can share more config if you let me
know what exactly.
Cheers, Jos
Post by heasley
Post by Jos
Post by Jos
ipv4 access-list no-rfc1918
remark Deny traffic to RFC 1918
deny ipv4 10.0.0.0/8 any
deny ipv4 any 10
deny ipv4 172.16.0.0/12 any
deny ipv4 any 172
deny ipv4 192.168.0.0/16 any
deny ipv4 any 192
permit ipv4 any any
A minor problem where the ACL is obvious as above, but this is the
exception.
Can someone suggest a good fix or workaround for this please
(preferably
Post by Jos
without changing the ASR9K config), I trust it affects others with
this
Post by Jos
sort of config?
I can see earlier posts mention xrrancid but can’t find that in our
3.1
Post by Jos
install.
This appears to be rancid's acl renumbering, which is the designed
behaviour for good reasons.
I dont think so; yes its removing the line numbers, but its botching every
other line.
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
heasley
2014-10-20 23:13:56 UTC
Permalink
Post by Peter Jackson
I looked over the script last night and I think the tail end of the lines are being dropped because the regex needs to be tweaked. \w in Perl regex doesn't match a period, does it? If not, then the regex matches only up to the first period in the IP address and that is why the rest of the line is dropped.
Indeed that regex needs some adjustment. What you suggest will fix the
truncation and is a good start, but the process needs to be expanded to
pick out the address properly. thanks
Post by Peter Jackson
I will look again when I get a chance.
Post by Jos
Hi Guys
Thanks to you both for the replies. I should have mentioned I’ve tried the
ACL-SORT option being disabled/enabled in config without seeing any
# if ACLSORT is NO, access-lists will NOT be sorted.
ACLSORT=NO; export ACLSORT
#
I have tried removing “export ACLSORT” with no luck either.
I have 4 or 5 ASR9K’s running 4.3.x and all do the same thing. Perhaps a
ipv4 access-list name
permit ipv4 any 166
remark the below subnet is currently not in use
permit ipv4 any 166
ipv4 access-list name
10 permit ipv4 any 166.1xx.xx.xx/28
20 remark the below subnet is currently not in use
30 permit ipv4 any 166.1xx.xx.xxx/28
- so the rancid backup leaves a bit to be desired here I think.
expect version 5.44.1.15
This is on centos 6.5, I had the packaged version of rancid installed, an
old 2.3.8 or something but then grabbed 3.1 and compiled it and have
removed the package.
Thanks for all your help with this, I can share more config if you let me
know what exactly.
Cheers, Jos
Post by heasley
Post by Jos
Post by Jos
ipv4 access-list no-rfc1918
remark Deny traffic to RFC 1918
deny ipv4 10.0.0.0/8 any
deny ipv4 any 10
deny ipv4 172.16.0.0/12 any
deny ipv4 any 172
deny ipv4 192.168.0.0/16 any
deny ipv4 any 192
permit ipv4 any any
A minor problem where the ACL is obvious as above, but this is the
exception.
Can someone suggest a good fix or workaround for this please
(preferably
Post by Jos
without changing the ASR9K config), I trust it affects others with
this
Post by Jos
sort of config?
I can see earlier posts mention xrrancid but can’t find that in our
3.1
Post by Jos
install.
This appears to be rancid's acl renumbering, which is the designed
behaviour for good reasons.
I dont think so; yes its removing the line numbers, but its botching every
other line.
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Anson Maddock
2014-10-16 01:19:57 UTC
Permalink
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>I&#39;m utilizing Rancid 3.1 on Debian currently, I also have the repositories and CVS from when we were running 2.3.8. We do not have ACLSORT enabled and we are not seeing the problems you are describing. Our ASR9Ks are running 4.3.2 code. We are not not showing any truncation in the configs/CVS from our 2.3.8 database.<br/>
Here is the sort from our xrrancid 3.1 distribution file. Can you confirm that the xrrancid file is a 3.1 version?<br/>
<br/>
# This is a sort routine that will sort on the<br/>
# ip address when the ip address is anywhere in<br/>
# the strings.<br/>
sub ipsort {<br/>
local(%lines) = @_;<br/>
local(&#36;i) = 0;<br/>
local(@sorted_lines);<br/>
foreach &#36;addr (sort sortbyipaddr keys %lines) {<br/>
&#36;sorted_lines[&#36;i] = &#36;lines{&#36;addr};<br/>
&#36;i++;<br/>
}<br/>
@sorted_lines;<br/>
}<br/>
<br/>
# These two routines will sort based upon IP addresses<br/>
sub ipaddrval {<br/>
my(@a) = (&#36;_[0] =~ m#^(&#92;d+)&#92;.(&#92;d+)&#92;.(&#92;d+)&#92;.(&#92;d+)&#36;#);<br/>
&#36;a[3] + 256 * (&#36;a[2] + 256 * (&#36;a[1] +256 * &#36;a[0]));<br/>
}<br/>
sub sortbyipaddr {<br/>
&amp;ipaddrval(&#36;a) &lt;=&gt; &amp;ipaddrval(&#36;b);<br/>
}<br/>
<br/>
-----Original Message-----<br/>
On Wed, 15 Oct 2014 23:14:09 +0200<br/>
Alan McKinnon &lt;***@gmail.com&gt; wrote:<br/>
<br/>
On 15/10/2014 09:59, Jos wrote:<br/>
&gt; Hi Guys<br/>
&gt;<br/>
&gt; Thanks to you both for the replies. I should have mentioned I&rsquo;ve tried the<br/>
&gt; ACL-SORT option being disabled/enabled in config without seeing any<br/>
&gt; success, I had this line in rancid.conf:<br/>
&gt;<br/>
&gt; # if ACLSORT is NO, access-lists will NOT be sorted.<br/>
&gt; ACLSORT=NO; export ACLSORT<br/>
&gt; #<br/>
&gt;<br/>
&gt; I have tried removing &ldquo;export ACLSORT&rdquo; with no luck either.<br/>
&gt;<br/>
&gt;<br/>
&gt; I have 4 or 5 ASR9K&rsquo;s running 4.3.x and all do the same thing. Perhaps a<br/>
&gt; better example is this one:<br/>
&gt;<br/>
&gt; Rancid backs up this:<br/>
&gt; ipv4 access-list name<br/>
&gt; permit ipv4 any 166<br/>
&gt; remark the below subnet is currently not in use<br/>
&gt; permit ipv4 any 166<br/>
&gt;<br/>
&gt; What we have configured is:<br/>
&gt; ipv4 access-list name<br/>
&gt; 10 permit ipv4 any 166.1xx.xx.xx/28<br/>
&gt; 20 remark the below subnet is currently not in use<br/>
&gt; 30 permit ipv4 any 166.1xx.xx.xxx/28<br/>
&gt;<br/>
&gt;<br/>
&gt; - so the rancid backup leaves a bit to be desired here I think.<br/>
<br/>
<br/>
The truncated address is due to this code in WriteTerm():<br/>
<br/>
if (/^ipv(4&#124;6) access-list (&#92;S+)&#92;s*&#36;/) {<br/>
...<br/>
while (&lt;INPUT&gt;) {<br/>
...<br/>
(&#36;seq, &#36;cmd, &#36;misc, &#36;ip) = (&#36;_ =~ /^&#92;s+(&#92;d+) (&#92;w+) (.*&#92;s)(&#92;w+)/);<br/>
if (&#36;cmd =~ /(permit&#124;deny)/) {<br/>
ProcessHistory(&quot;ACL &#36;nlri &#36;key &#36;cmd&quot;,<br/>
&quot;&#36;aclsort&quot;,&quot;&#36;ip&quot;, &quot; &#36;cmd &#36;misc&#36;ip&#92;n&quot;);<br/>
...<br/>
}<br/>
}<br/>
<br/>
<br/>
That final (&#92;w+) stops at the first dot.<br/>
<br/>
I&#39;m no Cisco guru and don&#39;t know all the permutations of how XR lists<br/>
access-lists, but I imagine the address must be everything after<br/>
&quot;ipv(4&#124;6) any &quot;, so the regex should probably become:<br/>
<br/>
<br/>
(&#36;_ =~ /^&#92;s+(&#92;d+) (&#92;w+) (.*&#92;s)(.*)/)<br/>
<br/>
<br/>
This is for 2.3.8 (I don&#39;t have a 3.x install to hand to check)<br/>
<br/>
&gt;<br/>
&gt; I have:<br/>
&gt; expect version 5.44.1.15<br/>
&gt; This is on centos 6.5, I had the packaged version of rancid installed, an<br/>
&gt; old 2.3.8 or something but then grabbed 3.1 and compiled it and have<br/>
&gt; removed the package.<br/>
&gt;<br/>
&gt;<br/>
&gt; Thanks for all your help with this, I can share more config if you let me<br/>
&gt; know what exactly.<br/>
&gt;<br/>
&gt; Cheers, Jos<br/>
&gt;<br/>
&gt;<br/>
&gt; On 15/10/14 18:27, &quot;heasley&quot; &lt;***@shrubbery.net&gt; wrote:<br/>
&gt;<br/>
&gt;&gt; Wed, Oct 15, 2014 at 07:22:23AM +0200, Alan McKinnon:<br/>
&gt;&gt;&gt;&gt; Rancid collected config:<br/>
&gt;&gt;&gt;&gt; ipv4 access-list no-rfc1918<br/>
&gt;&gt;&gt;&gt; remark Deny traffic to RFC 1918<br/>
&gt;&gt;&gt;&gt; deny ipv4 10.0.0.0/8 any<br/>
&gt;&gt;&gt;&gt; deny ipv4 any 10<br/>
&gt;&gt;&gt;&gt; deny ipv4 172.16.0.0/12 any<br/>
&gt;&gt;&gt;&gt; deny ipv4 any 172<br/>
&gt;&gt;&gt;&gt; deny ipv4 192.168.0.0/16 any<br/>
&gt;&gt;&gt;&gt; deny ipv4 any 192<br/>
&gt;&gt;&gt;&gt; permit ipv4 any any<br/>
&gt;&gt;&gt;&gt;<br/>
&gt;&gt;&gt;&gt;<br/>
&gt;&gt;&gt;&gt; A minor problem where the ACL is obvious as above, but this is the<br/>
&gt;&gt;&gt;&gt; exception.<br/>
&gt;&gt;&gt;&gt; Can someone suggest a good fix or workaround for this please<br/>
&gt;&gt;&gt; (preferably<br/>
&gt;&gt;&gt;&gt; without changing the ASR9K config), I trust it affects others with<br/>
&gt;&gt;&gt; this<br/>
&gt;&gt;&gt;&gt; sort of config?<br/>
&gt;&gt;&gt;&gt; I can see earlier posts mention xrrancid but can&rsquo;t find that in our<br/>
&gt;&gt;&gt; 3.1<br/>
&gt;&gt;&gt;&gt; install.<br/>
&gt;&gt;&gt;<br/>
&gt;&gt;&gt; This appears to be rancid&#39;s acl renumbering, which is the designed<br/>
&gt;&gt;&gt; behaviour for good reasons.<br/>
&gt;&gt;<br/>
&gt;&gt; I dont think so; yes its removing the line numbers, but its botching every<br/>
&gt;&gt; other line.<br/>
&gt;&gt; _______________________________________________<br/>
&gt;&gt; Rancid-discuss mailing list<br/>
&gt;&gt; Rancid-***@shrubbery.net<br/>
&gt;&gt; <a href="http://www.shrubbery.net/mailman/listinfo/rancid-discuss" target="_blank">http://www.shrubbery.net/mailman/listinfo/rancid-discuss</a><br/>
&gt;<br/>
&gt;<br/>
<br/>
<br/>
--<br/>
Alan McKinnon<br/>
***@gmail.com<br/>
<br/>
_______________________________________________<br/>
Rancid-discuss mailing list<br/>
Rancid-***@shrubbery.net<br/>
<a href="http://www.shrubbery.net/mailman/listinfo/rancid-discuss" target="_blank">http://www.shrubbery.net/mailman/listinfo/rancid-discuss</a></div></div></body></html>
Jos
2014-10-16 01:37:56 UTC
Permalink
Hi

Thanks for this, perhaps it’s as stupid as this, in my 3.1 install I don’t
have a xrrancid file, does it ship as part of the standalone 3.1 zipped
download?

Cheers, Jos
I'm utilizing Rancid 3.1 on Debian currently, I also have the
repositories and CVS from when we were running 2.3.8. We do not have
ACLSORT enabled and we are not seeing the problems you are describing.
Our ASR9Ks are running 4.3.2 code. We are not not showing any truncation
in the configs/CVS from our 2.3.8 database.
Here is the sort from our xrrancid 3.1 distribution file. Can you confirm
that the xrrancid file is a 3.1 version?
# This is a sort routine that will sort on the
# ip address when the ip address is anywhere in
# the strings.
sub ipsort {
local($i) = 0;
foreach $addr (sort sortbyipaddr keys %lines) {
$sorted_lines[$i] = $lines{$addr};
$i++;
}
@sorted_lines;
}
# These two routines will sort based upon IP addresses
sub ipaddrval {
$a[3] + 256 * ($a[2] + 256 * ($a[1] +256 * $a[0]));
}
sub sortbyipaddr {
&ipaddrval($a) <=> &ipaddrval($b);
}
-----Original Message-----
On Wed, 15 Oct 2014 23:14:09 +0200
Post by Jos
Hi Guys
Thanks to you both for the replies. I should have mentioned I’ve tried
the
ACL-SORT option being disabled/enabled in config without seeing any
# if ACLSORT is NO, access-lists will NOT be sorted.
ACLSORT=NO; export ACLSORT
#
I have tried removing “export ACLSORT” with no luck either.
I have 4 or 5 ASR9K’s running 4.3.x and all do the same thing. Perhaps a
ipv4 access-list name
permit ipv4 any 166
remark the below subnet is currently not in use
permit ipv4 any 166
ipv4 access-list name
10 permit ipv4 any 166.1xx.xx.xx/28
20 remark the below subnet is currently not in use
30 permit ipv4 any 166.1xx.xx.xxx/28
- so the rancid backup leaves a bit to be desired here I think.
if (/^ipv(4|6) access-list (\S+)\s*$/) {
...
while (<INPUT>) {
...
($seq, $cmd, $misc, $ip) = ($_ =~ /^\s+(\d+) (\w+) (.*\s)(\w+)/);
if ($cmd =~ /(permit|deny)/) {
ProcessHistory("ACL $nlri $key $cmd",
"$aclsort","$ip", " $cmd $misc$ip\n");
...
}
}
That final (\w+) stops at the first dot.
I'm no Cisco guru and don't know all the permutations of how XR lists
access-lists, but I imagine the address must be everything after
($_ =~ /^\s+(\d+) (\w+) (.*\s)(.*)/)
This is for 2.3.8 (I don't have a 3.x install to hand to check)
Post by Jos
expect version 5.44.1.15
This is on centos 6.5, I had the packaged version of rancid installed,
an
old 2.3.8 or something but then grabbed 3.1 and compiled it and have
removed the package.
Thanks for all your help with this, I can share more config if you let
me
know what exactly.
Cheers, Jos
Post by heasley
Post by Jos
Post by Jos
ipv4 access-list no-rfc1918
remark Deny traffic to RFC 1918
deny ipv4 10.0.0.0/8 any
deny ipv4 any 10
deny ipv4 172.16.0.0/12 any
deny ipv4 any 172
deny ipv4 192.168.0.0/16 any
deny ipv4 any 192
permit ipv4 any any
A minor problem where the ACL is obvious as above, but this is the
exception.
Can someone suggest a good fix or workaround for this please
(preferably
Post by Jos
without changing the ASR9K config), I trust it affects others with
this
Post by Jos
sort of config?
I can see earlier posts mention xrrancid but can’t find that in our
3.1
Post by Jos
install.
This appears to be rancid's acl renumbering, which is the designed
behaviour for good reasons.
I dont think so; yes its removing the line numbers, but its botching
every
other line.
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
--
Alan McKinnon
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Anson Maddock
2014-10-16 01:59:42 UTC
Permalink
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>I apologize I just realized that I the wrong file open I had looked at the 3.1 version of Extreme Networks xrancid not xrrancid which is the one I had open when I was looking at the script from below. In 3.1 they removed that file and integrated it into the rancid.types.base file. If you want to compare what you have the ftp://ftp.shrubbery.net/pub/rancid/rancid-3.1.tar.gz is what we built our distribution off of since there wasn&#39;t a package available for Debian.<br/>
<br/>
-----Original Message-----<br/>
On Thu, 16 Oct 2014 14:37:56 +1300<br/>
Jos &lt;***@clear.net.nz&gt; wrote:<br/>
<br/>
Hi<br/>
<br/>
Thanks for this, perhaps it&rsquo;s as stupid as this, in my 3.1 install I don&rsquo;t<br/>
have a xrrancid file, does it ship as part of the standalone 3.1 zipped<br/>
download?<br/>
<br/>
Cheers, Jos<br/>
<br/>
On 16/10/14 14:19, &quot;Anson Maddock&quot; &lt;***@gmx.com&gt; wrote:<br/>
<br/>
&gt;I&#39;m utilizing Rancid 3.1 on Debian currently, I also have the<br/>
&gt;repositories and CVS from when we were running 2.3.8. We do not have<br/>
&gt;ACLSORT enabled and we are not seeing the problems you are describing.<br/>
&gt;Our ASR9Ks are running 4.3.2 code. We are not not showing any truncation<br/>
&gt;in the configs/CVS from our 2.3.8 database.<br/>
&gt;Here is the sort from our xrrancid 3.1 distribution file. Can you confirm<br/>
&gt;that the xrrancid file is a 3.1 version?<br/>
&gt;<br/>
&gt;# This is a sort routine that will sort on the<br/>
&gt;# ip address when the ip address is anywhere in<br/>
&gt;# the strings.<br/>
&gt;sub ipsort {<br/>
&gt;local(%lines) = @_;<br/>
&gt;local(&#36;i) = 0;<br/>
&gt;local(@sorted_lines);<br/>
&gt;foreach &#36;addr (sort sortbyipaddr keys %lines) {<br/>
&gt;&#36;sorted_lines[&#36;i] = &#36;lines{&#36;addr};<br/>
&gt;&#36;i++;<br/>
&gt;}<br/>
&gt;@sorted_lines;<br/>
&gt;}<br/>
&gt;<br/>
&gt;# These two routines will sort based upon IP addresses<br/>
&gt;sub ipaddrval {<br/>
&gt;my(@a) = (&#36;_[0] =~ m#^(&#92;d+)&#92;.(&#92;d+)&#92;.(&#92;d+)&#92;.(&#92;d+)&#36;#);<br/>
&gt;&#36;a[3] + 256 * (&#36;a[2] + 256 * (&#36;a[1] +256 * &#36;a[0]));<br/>
&gt;}<br/>
&gt;sub sortbyipaddr {<br/>
&gt;&amp;ipaddrval(&#36;a) &lt;=&gt; &amp;ipaddrval(&#36;b);<br/>
&gt;}<br/>
&gt;<br/>
&gt;-----Original Message-----<br/>
&gt;On Wed, 15 Oct 2014 23:14:09 +0200<br/>
&gt;Alan McKinnon &lt;***@gmail.com&gt; wrote:<br/>
&gt;<br/>
&gt;On 15/10/2014 09:59, Jos wrote:<br/>
&gt;&gt; Hi Guys<br/>
&gt;&gt;<br/>
&gt;&gt; Thanks to you both for the replies. I should have mentioned I&rsquo;ve tried<br/>
&gt;&gt;the<br/>
&gt;&gt; ACL-SORT option being disabled/enabled in config without seeing any<br/>
&gt;&gt; success, I had this line in rancid.conf:<br/>
&gt;&gt;<br/>
&gt;&gt; # if ACLSORT is NO, access-lists will NOT be sorted.<br/>
&gt;&gt; ACLSORT=NO; export ACLSORT<br/>
&gt;&gt; #<br/>
&gt;&gt;<br/>
&gt;&gt; I have tried removing &ldquo;export ACLSORT&rdquo; with no luck either.<br/>
&gt;&gt;<br/>
&gt;&gt;<br/>
&gt;&gt; I have 4 or 5 ASR9K&rsquo;s running 4.3.x and all do the same thing. Perhaps a<br/>
&gt;&gt; better example is this one:<br/>
&gt;&gt;<br/>
&gt;&gt; Rancid backs up this:<br/>
&gt;&gt; ipv4 access-list name<br/>
&gt;&gt; permit ipv4 any 166<br/>
&gt;&gt; remark the below subnet is currently not in use<br/>
&gt;&gt; permit ipv4 any 166<br/>
&gt;&gt;<br/>
&gt;&gt; What we have configured is:<br/>
&gt;&gt; ipv4 access-list name<br/>
&gt;&gt; 10 permit ipv4 any 166.1xx.xx.xx/28<br/>
&gt;&gt; 20 remark the below subnet is currently not in use<br/>
&gt;&gt; 30 permit ipv4 any 166.1xx.xx.xxx/28<br/>
&gt;&gt;<br/>
&gt;&gt;<br/>
&gt;&gt; - so the rancid backup leaves a bit to be desired here I think.<br/>
&gt;<br/>
&gt;<br/>
&gt;The truncated address is due to this code in WriteTerm():<br/>
&gt;<br/>
&gt;if (/^ipv(4&#124;6) access-list (&#92;S+)&#92;s*&#36;/) {<br/>
&gt;...<br/>
&gt;while (&lt;INPUT&gt;) {<br/>
&gt;...<br/>
&gt;(&#36;seq, &#36;cmd, &#36;misc, &#36;ip) = (&#36;_ =~ /^&#92;s+(&#92;d+) (&#92;w+) (.*&#92;s)(&#92;w+)/);<br/>
&gt;if (&#36;cmd =~ /(permit&#124;deny)/) {<br/>
&gt;ProcessHistory(&quot;ACL &#36;nlri &#36;key &#36;cmd&quot;,<br/>
&gt;&quot;&#36;aclsort&quot;,&quot;&#36;ip&quot;, &quot; &#36;cmd &#36;misc&#36;ip&#92;n&quot;);<br/>
&gt;...<br/>
&gt;}<br/>
&gt;}<br/>
&gt;<br/>
&gt;<br/>
&gt;That final (&#92;w+) stops at the first dot.<br/>
&gt;<br/>
&gt;I&#39;m no Cisco guru and don&#39;t know all the permutations of how XR lists<br/>
&gt;access-lists, but I imagine the address must be everything after<br/>
&gt;&quot;ipv(4&#124;6) any &quot;, so the regex should probably become:<br/>
&gt;<br/>
&gt;<br/>
&gt;(&#36;_ =~ /^&#92;s+(&#92;d+) (&#92;w+) (.*&#92;s)(.*)/)<br/>
&gt;<br/>
&gt;<br/>
&gt;This is for 2.3.8 (I don&#39;t have a 3.x install to hand to check)<br/>
&gt;<br/>
&gt;&gt;<br/>
&gt;&gt; I have:<br/>
&gt;&gt; expect version 5.44.1.15<br/>
&gt;&gt; This is on centos 6.5, I had the packaged version of rancid installed,<br/>
&gt;&gt;an<br/>
&gt;&gt; old 2.3.8 or something but then grabbed 3.1 and compiled it and have<br/>
&gt;&gt; removed the package.<br/>
&gt;&gt;<br/>
&gt;&gt;<br/>
&gt;&gt; Thanks for all your help with this, I can share more config if you let<br/>
&gt;&gt;me<br/>
&gt;&gt; know what exactly.<br/>
&gt;&gt;<br/>
&gt;&gt; Cheers, Jos<br/>
&gt;&gt;<br/>
&gt;&gt;<br/>
&gt;&gt; On 15/10/14 18:27, &quot;heasley&quot; &lt;***@shrubbery.net&gt; wrote:<br/>
&gt;&gt;<br/>
&gt;&gt;&gt; Wed, Oct 15, 2014 at 07:22:23AM +0200, Alan McKinnon:<br/>
&gt;&gt;&gt;&gt;&gt; Rancid collected config:<br/>
&gt;&gt;&gt;&gt;&gt; ipv4 access-list no-rfc1918<br/>
&gt;&gt;&gt;&gt;&gt; remark Deny traffic to RFC 1918<br/>
&gt;&gt;&gt;&gt;&gt; deny ipv4 10.0.0.0/8 any<br/>
&gt;&gt;&gt;&gt;&gt; deny ipv4 any 10<br/>
&gt;&gt;&gt;&gt;&gt; deny ipv4 172.16.0.0/12 any<br/>
&gt;&gt;&gt;&gt;&gt; deny ipv4 any 172<br/>
&gt;&gt;&gt;&gt;&gt; deny ipv4 192.168.0.0/16 any<br/>
&gt;&gt;&gt;&gt;&gt; deny ipv4 any 192<br/>
&gt;&gt;&gt;&gt;&gt; permit ipv4 any any<br/>
&gt;&gt;&gt;&gt;&gt;<br/>
&gt;&gt;&gt;&gt;&gt;<br/>
&gt;&gt;&gt;&gt;&gt; A minor problem where the ACL is obvious as above, but this is the<br/>
&gt;&gt;&gt;&gt;&gt; exception.<br/>
&gt;&gt;&gt;&gt;&gt; Can someone suggest a good fix or workaround for this please<br/>
&gt;&gt;&gt;&gt; (preferably<br/>
&gt;&gt;&gt;&gt;&gt; without changing the ASR9K config), I trust it affects others with<br/>
&gt;&gt;&gt;&gt; this<br/>
&gt;&gt;&gt;&gt;&gt; sort of config?<br/>
&gt;&gt;&gt;&gt;&gt; I can see earlier posts mention xrrancid but can&rsquo;t find that in our<br/>
&gt;&gt;&gt;&gt; 3.1<br/>
&gt;&gt;&gt;&gt;&gt; install.<br/>
&gt;&gt;&gt;&gt;<br/>
&gt;&gt;&gt;&gt; This appears to be rancid&#39;s acl renumbering, which is the designed<br/>
&gt;&gt;&gt;&gt; behaviour for good reasons.<br/>
&gt;&gt;&gt;<br/>
&gt;&gt;&gt; I dont think so; yes its removing the line numbers, but its botching<br/>
&gt;&gt;&gt;every<br/>
&gt;&gt;&gt; other line.<br/>
&gt;&gt;&gt; _______________________________________________<br/>
&gt;&gt;&gt; Rancid-discuss mailing list<br/>
&gt;&gt;&gt; Rancid-***@shrubbery.net<br/>
&gt;&gt;&gt; <a href="http://www.shrubbery.net/mailman/listinfo/rancid-discuss" target="_blank">http://www.shrubbery.net/mailman/listinfo/rancid-discuss</a><br/>
&gt;&gt;<br/>
&gt;&gt;<br/>
&gt;<br/>
&gt;<br/>
&gt;--<br/>
&gt;Alan McKinnon<br/>
&gt;***@gmail.com<br/>
&gt;<br/>
&gt;_______________________________________________<br/>
&gt;Rancid-discuss mailing list<br/>
&gt;Rancid-***@shrubbery.net<br/>
&gt;<a href="http://www.shrubbery.net/mailman/listinfo/rancid-discuss" target="_blank">http://www.shrubbery.net/mailman/listinfo/rancid-discuss</a><br/>
&gt;<br/>
&gt;_______________________________________________<br/>
&gt;Rancid-discuss mailing list<br/>
&gt;Rancid-***@shrubbery.net<br/>
&gt;<a href="http://www.shrubbery.net/mailman/listinfo/rancid-discuss" target="_blank">http://www.shrubbery.net/mailman/listinfo/rancid-discuss</a><br/>
<br/>
<br/>
&nbsp;</div></div></body></html>
Loading...