Sponsored Content
Top Forums Shell Programming and Scripting ip address and subnet comparing Post 302088825 by fedora on Thursday 14th of September 2006 03:50:16 PM
Old 09-14-2006
ip address and subnet comparing

Hmmm, tough question for me, so I put it here.

I am trying to use shell script or mysql to do the following thing.

tableA, in which all are single ips.

sip
-------
1.2.3.4
8.8.8.8
123.3.32.1
....


and tableB, a list of our group subnets.

subnet
---------
1.0.0.0/8
20.0.1.0/24
.....

What I want is only picking up those ips belong to our group from tableA according to the subnet tableB

I have no idea on this till now, so can anyone give me some instructions?

Thank a lot!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Modifying IP Address/Gateway/Subnet in SCO Unix

Hi, I'm new to unix and have absolutely no experience with it. I am trying to change the network setting on the only computer on our network with SCO Unix. We switched ISP's and now have a new set of IP's. I can't for the life of me figure out how to go in and change these settings, please help.... (12 Replies)
Discussion started by: PBNOSGT
12 Replies

2. SCO

ACL for Subnet/IP address

I am trying to find out if you can create an ACL for telnet sessions and restrict it to a certain subnet/IP range.. any information or where to look would be greatly appreciated. thanks (1 Reply)
Discussion started by: marvin51796
1 Replies

3. IP Networking

Migrating existing Subnet to a new subnet and changing ip addresses in UNIX

Hi, My project needs to migrate the existing Subnet (255.255.255.0) to a new subnet and change the ipaddresses (currently C class). How can I do that. I need some information. John (0 Replies)
Discussion started by: johnmarsh
0 Replies

4. IP Networking

How do I figure out the subnet?

Hi, How do I get subnet from this: 10.252.0.138/25 Tnx (2 Replies)
Discussion started by: mehrdad68
2 Replies

5. UNIX for Dummies Questions & Answers

Panic kernal-mode address fault on user address 0x14

:) Firstly Hi all!!, im NEW!! and on here hoping that someone might be able to offer me some help... i have a server that keeps crashing every few days with the error message: PANIC KERNAL-MODE ADDRESS FAULT ON USER ADDRESS 0X14 KERNAL PAGE FAULT FROM (CS:EIP)=(100:EF71B5BD) EAX=EF822000... (10 Replies)
Discussion started by: Twix
10 Replies

6. AIX

AIX:Command to get netaddress/subnet address command in IPv4/IP6

AIX:Command to get netaddress/subnet address command in IPv4/IP6 Can anybody help us with a command to retrieve netaddress/subnet address command in IPv4/IP6 on aix machine. net/subnet address is in the format 172.16.212.0(signifies all 255 machines in an IPv4 network) (2 Replies)
Discussion started by: rookie8278
2 Replies

7. IP Networking

lookup ip address, subnet mask, gateway, and dns at same time

Is there a command that can lookup ip address, subnet mask, gateway, and dns all at the same. I know ifconfig can lookup ip address and subnet mask. I know route -n can lookup gateway. Not sure about a dns command. So I hope there is a way to lookup ip address, subnet mask, gateway, and dns all at... (2 Replies)
Discussion started by: cokedude
2 Replies

8. Shell Programming and Scripting

Grep IP address form a text file along with the subnet

I have an input file: class 1 3 5 10.10.10..0/23 hicks jimmy class 3 10.12.10.0/22 mike class.019283 10.10.15.10/20 henry gym.847585 45 192.168.10.0/22 nancy jim steve maya The output should look like this: 10.10.10..0/23 10.12.10.0/22 10.10.15.10/20 192.168.10.0/22 I have the... (3 Replies)
Discussion started by: e_mikey_2000
3 Replies

9. Shell Programming and Scripting

Get all ip address from subnet mask

I have this subnet file shown below. How can I calculate all ip addresses from that list 103.22.200.0/22 141.101.64.0/18 10.0.0.0/22I need to be able to read the subnet file and print all IPs in those subnet to an out put file (3 Replies)
Discussion started by: e_mikey_2000
3 Replies

10. UNIX for Advanced & Expert Users

C program to detect duplicate ip address if any after assigning ip address to ethernet interface

Hi , Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies
IPSEC_SAMEADDR(3)					     Library Functions Manual						 IPSEC_SAMEADDR(3)

NAME
ipsec_sameaddr, ipsec_addrcmp, ipsec_samesubnet, ipsec_addrinsubnet, ipsec_subnetinsubnet, ipsec_subnetishost, ipsec_samesaid, ipsec_sameaddrtype, ipsec_samesubnettype - do comparisons for addresses, subnets, SA IDs and address families SYNOPSIS
#include <freeswan.h> int sameaddr(const ip_address *a, const ip_address *b); int addrcmp(const ip_address *a, const ip_address *b); int samesubnet(const ip_subnet *a, const ip_subnet *b); int addrinsubnet(const ip_address *a, const ip_subnet *s); int subnetinsubnet(const ip_subnet *a, const ip_subnet *b); int subnetishost(const ip_subnet *s); int samesaid(const ip_said *a, const ip_said *b); int sameaddrtype(const ip_address *a, const ip_address *b); int samesubnettype(const ip_subnet *a, const ip_subnet *b); DESCRIPTION
These functions do various comparisons and tests on the ip_address type and ip_subnet types. Sameaddr returns non-zero if addresses a and b are identical, and 0 otherwise. Addresses of different families are never identical. Addrcmp returns -1, 0, or 1 respectively if address a is less than, equal to, or greater than b. If they are not of the same address fam- ily, they are never equal; the ordering reported in this case is arbitrary (and probably not useful) but consistent. Samesubnet returns non-zero if subnets a and b are identical, and 0 otherwise. Subnets of different address families are never identical. Addrinsubnet returns non-zero if address a is within subnet s and 0 otherwise. An address is never within a subnet of a different address family. Subnetinsubnet returns non-zero if subnet a is a subset of subnet b and 0 otherwise. A subnet is deemed to be a subset of itself. A sub- net is never a subset of another subnet if their address families differ. Subnetishost returns non-zero if subnet s is in fact only a single host, and 0 otherwise. Samesaid returns non-zero if SA IDs a and b are identical, and 0 otherwise. Sameaddrtype returns non-zero if addresses a and b are of the same address family, and 0 otherwise. Samesubnettype returns non-zero if subnets a and b are of the same address family, and 0 otherwise. SEE ALSO
inet(3), ipsec_initaddr(3) HISTORY
Written for the FreeS/WAN project by Henry Spencer. 28 Nov 2000 IPSEC_SAMEADDR(3)
All times are GMT -4. The time now is 08:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy