Sponsored Content
Top Forums Shell Programming and Scripting Convert ip ranges to CIDR netblocks Post 302996583 by Corona688 on Thursday 27th of April 2017 02:35:29 PM
Old 04-27-2017
The trick to that is, where it should cut off? Hypothetically speaking you can encompass 1.1.1.1 and 254.254.254.254 with the mask 0.0.0.0 but I doubt you want that. You could also do 100% perfect groups with no empty spaces but I doubt you want that either.
 

9 More Discussions You Might Find Interesting

1. HP-UX

Valid ranges for uids for HP-UX

Hi , I am using adduser in hp-ux to create users in Hp-ux. i would like to know what are the valid values for uids and gids in hp-ux what are the rannges for the valid uids . How to check what are the used uids in Hp-ux . Thanks Narendra babu C (7 Replies)
Discussion started by: naren_chella
7 Replies

2. Shell Programming and Scripting

Get IP list from CIDR

Dear Srs :-) I'm looking for a shell script, that given a network in CIDR format it lists all IPs, for example: Preferredly a shell script, but a Perl, Python, C, etc.. is also welcome :-) I have been looking in sipcalc, ipcalc, etc.. options but this feature is not implemented :-( ... (10 Replies)
Discussion started by: Santi
10 Replies

3. Shell Programming and Scripting

date ranges

Hi, Please anyone help to achive this using perl or unix scripting . This is date in my table 20090224,based on the date need to check the files,If file exist for that date then increment by 1 for that date and check till max date 'i.e.20090301 and push those files . files1_20090224... (2 Replies)
Discussion started by: akil
2 Replies

4. Programming

How to parse IP range in CIDR format in C

Hello everybody, I'm coding a network program and i need it to "understand" ip ranges, but i don't know how to make to parse an IP CIDR range, let's say "172.16.10.0/24" to work with the specified IP range. I've found a program which does it, but i don't understand the code. Here is the... (3 Replies)
Discussion started by: semash!
3 Replies

5. UNIX for Dummies Questions & Answers

Need help filling in ranges

I have a list of about 200,000 lines in a text file that look like this: 1 1 120 1 80 200 1 150 270 5 50 170 5 100 220 5 300 420 The first column is an identifier, the next 2 columns are a range (always 120 value range) I'm trying fill in the values of those ranges, and remove... (4 Replies)
Discussion started by: knott76
4 Replies

6. Shell Programming and Scripting

Values between ranges

Hi, I have two files file1 chr1_22450_22500 chr2_12300_12350 chr1_34500_34550 file2 11000_13000 15000_19000 33000_44000 If the file 1 ranges fall between file2 ranges then assign the value of file2 in column 2 to file1 output: chr2_12300_12350 11000_13000 chr1_34500_34550 ... (7 Replies)
Discussion started by: Diya123
7 Replies

7. Shell Programming and Scripting

How to convert multiple number ranges into sequence?

Looking for a simple way to convert ranges to a numerical sequence that would assign the original value of the range to the individual numbers that are on the range. Thank you given data 13196-13199 0 13200 4 13201 10 13202-13207 3 13208-13210 7 desired... (3 Replies)
Discussion started by: jcue25
3 Replies

8. Shell Programming and Scripting

How to change ip addressing format from CIDR notation to netmask and vice versa?

Hi all, I would appreciate if someone could share how to convert CIDR notation to netmask and vice versa. The value below is just an example. it could be different numbers/ip addresses. Initial Output, let say file1.txt Final Output, let say file2.txt (3 Replies)
Discussion started by: type8code0
3 Replies

9. Shell Programming and Scripting

Convert ip ranges to CIDR netblock

2 scripts to convert IP ranges to CIDR notation using awk, gawk or mawk. The scripts are much faster than using ipcalc and will return the same results. The first script is reliably compatible with awk, gawk and mawk but is over 3 times as slow as the second script which is reliably compatible with... (38 Replies)
Discussion started by: azdps
38 Replies
PFSYNC(4)						   BSD Kernel Interfaces Manual 						 PFSYNC(4)

NAME
pfsync -- packet filter state table logging interface SYNOPSIS
device pfsync DESCRIPTION
The pfsync interface is a pseudo-device which exposes certain changes to the state table used by pf(4). If configured with a physical syn- chronisation interface, pfsync will send state changes out on that interface using IP multicast, and insert state changes received on that interface from other systems into the state table. By default, all local changes to the state table are exposed via pfsync. However, state changes from packets received by pfsync over the network are not rebroadcast. States created by a rule marked with the no-sync keyword are omitted from the pfsync interface (see pf.conf(5) for details). The pfsync interface will attempt to collapse multiple updates of the same state into one message where possible. The maximum number of times this can be done before the update is sent out is controlled by the maxupd parameter to ifconfig (see ifconfig(8) and the example below for more details). Each packet retrieved on this interface has a header associated with it of length PFSYNC_HDRLEN. The header indicates the version of the protocol, address family, action taken on the following states, and the number of state table entries attached in this packet. This struc- ture is defined in <net/if_pfsync.h> as: struct pfsync_header { u_int8_t version; u_int8_t af; u_int8_t action; u_int8_t count; }; NETWORK SYNCHRONISATION
States can be synchronised between two or more firewalls using this interface, by specifying a synchronisation interface using ifconfig(8). For example, the following command sets fxp0 as the synchronisation interface: # ifconfig pfsync0 syncdev fxp0 It is important that the underlying synchronisation interface is up and has an IP address assigned. By default, state change messages are sent out on the synchronisation interface using IP multicast packets. The protocol is IP protocol 240, PFSYNC, and the multicast group used is 224.0.0.240. When a peer address is specified using the syncpeer keyword, the peer address is used as a destination for the pfsync traffic, and the traffic can then be protected using ipsec(4). In such a configuration, the syncdev should be set to the enc(4) interface, as this is where the traffic arrives when it is decapsulated, e.g.: # ifconfig pfsync0 syncpeer 10.0.0.2 syncdev enc0 It is important that the pfsync traffic be well secured as there is no authentication on the protocol and it would be trivial to spoof pack- ets which create states, bypassing the pf ruleset. Either run the pfsync protocol on a trusted network - ideally a network dedicated to pfsync messages such as a crossover cable between two firewalls, or specify a peer address and protect the traffic with ipsec(4). For pfsync to start its operation automatically at the system boot time, pfsync_enable and pfsync_syncdev variables should be used in rc.conf(5). It is not advisable to set up pfsync with common network interface configuration variables of rc.conf(5) because pfsync must start after its syncdev, which cannot be always ensured in the latter case. EXAMPLES
pfsync and carp(4) can be used together to provide automatic failover of a pair of firewalls configured in parallel. One firewall handles all traffic - if it dies or is shut down, the second firewall takes over automatically. Both firewalls in this example have three sis(4) interfaces. sis0 is the external interface, on the 10.0.0.0/24 subnet; sis1 is the internal interface, on the 192.168.0.0/24 subnet; and sis2 is the pfsync interface, using the 192.168.254.0/24 subnet. A crossover cable connects the two firewalls via their sis2 interfaces. On all three interfaces, firewall A uses the .254 address, while firewall B uses .253. The inter- faces are configured as follows (firewall A unless otherwise indicated): Interfaces configuration in /etc/rc.conf: network_interfaces="lo0 sis0 sis1 sis2" cloned_interfaces="carp0 carp1" ifconfig_sis0="10.0.0.254/24" ifconfig_sis1="192.168.0.254/24" ifconfig_sis2="192.168.254.254/24" ifconfig_carp0="vhid 1 pass foo 10.0.0.1/24" ifconfig_carp1="vhid 2 pass bar 192.168.0.1/24" pfsync_enable="YES" pfsync_syncdev="sis2" pf(4) must also be configured to allow pfsync and carp(4) traffic through. The following should be added to the top of /etc/pf.conf: pass quick on { sis2 } proto pfsync pass on { sis0 sis1 } proto carp If it is preferable that one firewall handle the traffic, the advskew on the backup firewall's carp(4) interfaces should be set to something higher than the primary's. For example, if firewall B is the backup, its carp1 configuration would look like this: ifconfig_carp1="vhid 2 pass bar advskew 100 192.168.0.1/24" The following must also be added to /etc/sysctl.conf: net.inet.carp.preempt=1 BUGS
Possibility to view state changes using tcpdump(1) has not been ported from OpenBSD yet. SEE ALSO
bpf(4), carp(4), ifconfig(8), inet(4), inet6(4), ipsec(4), netintro(4), pf(4), pf.conf(5), protocols(5), rc.conf(5) ifconfig(8), ifstated(8), tcpdump(8) HISTORY
The pfsync device first appeared in OpenBSD 3.3. The pfsync device was imported to FreeBSD 5.3. BSD
June 6, 2006 BSD
All times are GMT -4. The time now is 04:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy