what do the numbers mean in ip rule show command
From the man page ip-rule
:
At startup time the kernel configures the default RPDB consisting of three rules:
1. Priority: 0, Selector: match anything, Action: lookup routing table local (ID 255). The local table is a special routing table containing high priority control routes for local and broadcast addresses. Rule 0 is special. It cannot be deleted or overridden. 2. Priority: 32766, Selector: match anything, Action: lookup routing table main (ID 254). The main table is the normal routing table containing all non-policy routes. This rule may be deleted and/or overridden with other ones by the administrator. 3. Priority: 32767, Selector: match anything, Action: lookup routing table default (ID 253). The default table is empty. It is reserved for some post-processing if no previous default rules selected the packet. This rule may also be deleted. Each RPDB entry has additional attributes. F.e. each rule has a pointer to some routing table. NAT and masquerading rules have an attribute to select new IP address to translate/masquerade. Besides that, rules have some optional attributes, which routes have, namely realms. These values do not override those contained in the routing tables. They are only used if the route did not select any attributes.
So those numbers, 0, 32766, and 32767 are the priority that the rules will get be applied.
NOTE: The other numbers mentioned above: 255, 254, and 253 correspond to the routing tables as described in this file:
$ more /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
The names above can then be used when querying the routing tables like so:
$ ip route show table local
broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1
local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1
broadcast 172.17.0.0 dev docker0 proto kernel scope link src 172.17.42.1
local 172.17.42.1 dev docker0 proto kernel scope host src 172.17.42.1
broadcast 172.17.255.255 dev docker0 proto kernel scope link src 172.17.42.1
broadcast 192.168.1.0 dev wlp1s0 proto kernel scope link src 192.168.1.80
local 192.168.1.80 dev wlp1s0 proto kernel scope host src 192.168.1.80
broadcast 192.168.1.255 dev wlp1s0 proto kernel scope link src 192.168.1.80
References
robspencer77
Updated on September 18, 2022Comments
-
robspencer77 over 1 year
I have an array of objects, each object has an NSDecimalNumber, call it "size"
For each object in the array, I will subtract a recommended size, called rSize.
I then want to go into the resultant NSDecimalNumber and get the value of the delta, don't really care if it's positive or negative result.
I think I'm going to use the decimalNumber method which will return a NSDecimal struct, so the question is: which property within the struct will give me the value of the delta?
To rephrase: A NSDecimal represents an NSDecimalNumber, but which property of the NSDecimal struct holds the value?
Many thanks Rob
-
一二三 about 11 yearsAll of the fields in the
NSDecimal struct
hold "the value"; why aren't you using-decimalNumberBySubtracting:
? -
robspencer77 about 11 yearsAll the fields hold the value? Does isNegative hold the value? ;) Also I am using decimalNumberBySubtraction, but the result could be a negative value. I just want the size of the delta.
-
一二三 about 11 yearsYes,
isNegative
holds the sign part of the value (+/-). What do you mean by "delta"? -
robspencer77 about 11 yearsThe size of the difference. So if I have an array of objects containing the sizes: 7,6,3,1 and the recommended size is 4. Then I will subtract 4 from each size, which will give: 3,2,-1 and -3. I don't really care whether it's plus or minus, I just want the delta, so 3,2,1,3.
-
robspencer77 about 11 yearsI can then reorder the array of objects by delta, which will give 3,6,1,7. So the first object in the array will be closest to the recommended size, i.e. 3, and 6 will be the second closest size. I can use isNegative to tell whether it's bigger or smaller, but I need to know what property of the NSDecimal struct give the size of the NSDecimalNumber it's describing.
-
slm over 9 yearstake a look in man
ip-rule
.
-
-
robspencer77 about 11 yearsYeah, that'll work. Thanks. Am I okay to set negOne as follows:
NSDecimalNumber negOne = [NSDecimalNumber decimalWithString@"-1";