Re: perl and network addresses

2006-04-03 Thread Kevin D. Clark
Stephen Ryan writes: Ooh, here's something interesting. I first tried a test with constants, and got the warning: left shift count = width of type out of gcc. Then I rewrote the thing to use a loop, and I got correct results out of it. (This is all on an Athlon64X2.) When you described

Re: perl and network addresses

2006-03-31 Thread Stephen Ryan
On Thu, 2006-03-30 at 20:35 -0500, Jason Stephenson wrote: Paul Lussier wrote: Yes, more or less. Between you and Jason I've been able to come up with exactly what I need. Thanks a lot for all your help. Why I couldn't see this for myself is beyond me. Of course, this week has been

Re: perl and network addresses

2006-03-31 Thread Jason Stephenson
Stephen Ryan wrote: Can anyone think of a better way to blit an arbitrary number of bits from 0 to 1? Well, let's see Taking advantage of the fact that all of the '1' bits are at the end of the hostmask, you've actually almost gotten it already. hostmask = (1 (32 - n)) - 1 netmask = ~

Re: perl and network addresses

2006-03-31 Thread Stephen Ryan
On Fri, 2006-03-31 at 21:00 -0500, Jason Stephenson wrote: Stephen Ryan wrote: hostmask = (1 (32 - n)) - 1 netmask = ~ hostmask Doh! That's so obvious, so obviously, I overlooked it. ;) Well, yes, of course :-) 1 (32 - n) in binary is (n-1) '0' bits, a '1', then (32 - n) '0'

Re: perl and network addresses

2006-03-30 Thread Paul Lussier
Ben Scott [EMAIL PROTECTED] writes: The 10.0.32/19 is an interesting beast. The systems which live on it have 2 NICs, the primary eth0, which *always* have a 10.0.32/19 based address (currently restricted to 10.0.33/24 for some reason?!),

Re: perl and network addresses

2006-03-30 Thread Jason Stephenson
Paul Lussier wrote: Yes, more or less. Between you and Jason I've been able to come up with exactly what I need. Thanks a lot for all your help. Why I couldn't see this for myself is beyond me. Of course, this week has been full of me missing the details to the point where I somehow managed

Re: perl and network addresses

2006-03-29 Thread Ben Scott
On 3/28/06, Paul Lussier [EMAIL PROTECTED] wrote: It's confusing. Sure is! Wow, that's one wacky setup. :) The 10.0.32/19 is an interesting beast. The systems which live on it have 2 NICs, the primary eth0, which *always* have a 10.0.32/19 based address (currently restricted to

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
Python [EMAIL PROTECTED] writes: Would it help to convert to 32-bit integers? I might. I'll try that. I think I understand the arithmetic. I do not really understand what you are trying to do. That's okay, neither do I ;) (If you really want the long convoluted discussion, I'll be glad

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
Ben Scott [EMAIL PROTECTED] writes: I tried perl -we '$a = inet_addr(192.0.2.42);' but it complained that inet_addr is not defined. I suspect there's a module somewhere you need to pull in. Hopefully this is enough to get you started. You likely need to use -MSocket, and then

Re: perl and network addresses

2006-03-28 Thread Jason Stephenson
Paul Lussier wrote: Python [EMAIL PROTECTED] writes: Would it help to convert to 32-bit integers? I might. I'll try that. It will definitely help. If you get the netmask and address both in 32-bit integers, then calculating the network and broadcast addresses is very straightforward.

Re: perl and network addresses

2006-03-28 Thread Ben Scott
On 3/28/06, Paul Lussier [EMAIL PROTECTED] wrote: If you really want the long convoluted discussion, I'll be glad to post it, I just figured no on would care. Well, everyone here knows *I* thrive on long, convoluted discussions. I'm also curious if you're trying to route packets through a

Re: perl and network addresses

2006-03-28 Thread Ben Scott
On 3/28/06, Jason Stephenson [EMAIL PROTECTED] wrote: Of course, after looking back through the thread, I see Ben has already pretty much answered the above. ;) Repetition is the very soul of the net. -- from alt.config Paul is using a network that is restricted to using a /19 netmask for

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
Jason Stephenson [EMAIL PROTECTED] writes: It seems to me that the answer is that your IP addresses are limited to the range of 10.0.32.0 to 10.0.63.255 with 10.0.0.0 being the network address and 10.255.255.255 being the broadcast address, no? Err, you've got the IP addresses wrong. It's

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
Ben Scott [EMAIL PROTECTED] writes: Well... okay... but it's the *why* that makes me wonder. :) I hope it's something interesting, and not just that he's trying to say that he's been assigned the addresses in the range 10.0.32.0/19 on the 10.0.0.0/16 network. That would be *so* boring.

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
Ben Scott [EMAIL PROTECTED] writes: On 3/28/06, Paul Lussier [EMAIL PROTECTED] wrote: If you really want the long convoluted discussion, I'll be glad to post it, I just figured no on would care. Well, everyone here knows *I* thrive on long, convoluted discussions. I'm also curious if

Re: perl and network addresses

2006-03-28 Thread Jason Stephenson
Paul Lussier wrote: Jason Stephenson [EMAIL PROTECTED] writes: It seems to me that the answer is that your IP addresses are limited to the range of 10.0.32.0 to 10.0.63.255 with 10.0.0.0 being the network address and 10.255.255.255 being the broadcast address, no? Err, you've got the IP

Re: perl and network addresses

2006-03-28 Thread Jason Stephenson
Paul Lussier wrote: Errr, no, just the opposite actually. Trying to *prevent* routing from a very existent router :) Sounds to me like what you really need is a router with VLAN capability. If I understand correctly, it sounds like you're trying to implement VLANs. Your setup actually

Re: perl and network addresses

2006-03-28 Thread Paul Lussier
Jason Stephenson [EMAIL PROTECTED] writes: I'd suggest looking up how to configure VLANs on whatever you're using for a router.--I know you mentioned a FreeBSD firewall earlier. You must have missed the part where I said we don't have a router, we're migrating to a comletely new network, and,

perl and network addresses

2006-03-27 Thread Paul Lussier
Hi all, I'm stumped. I've got a network address space of 10.0.32/19. How ever, this space is carved up using a /16 netmask. In otherwords, the /19 netmask was simply used to *allocate* the space from 10.0.32.0 to 10.0.63.255, but we actually *use* the space with a /16 netmask (yes, this means

Re: perl and network addresses

2006-03-27 Thread Python
On Mon, 2006-03-27 at 14:25 -0500, Paul Lussier wrote: Hi all, I'm stumped. I've got a network address space of 10.0.32/19. How ever, this space is carved up using a /16 netmask. In otherwords, the /19 netmask was simply used to *allocate* the space from 10.0.32.0 to 10.0.63.255, but we

Re: perl and network addresses

2006-03-27 Thread Ben Scott
On 3/27/06, Paul Lussier [EMAIL PROTECTED] wrote: I'm stumped. I've got a network address space of 10.0.32/19. How ever, this space is carved up using a /16 netmask. HUH? Given an address, say 10.0.33.189, I want to get the network and host portion of the address. (1) Red Hat provides