.:HSTuners::


::Hondas Wanted::
 

Go Back   HSTuners > The Lounge Area > Shifting Gears - Off Topic Discussions > For The Geek In You
User Name
Password
FAQ Members List Calendar Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 04-15-2003, 11:22 PM   #1
94_AcCoRd_EX
Insomniac Moderator
 
94_AcCoRd_EX's Avatar
 
Join Date: Aug 2001
Location: OR
Age: 43
Posts: 11,142
Please help with Perl program!

Here's all I know about the assignment:

/proc/net/dev - Identify how many ethernet devices that I have and identify which one is "upstream" by looking at the default route.

example output:
eth0 192.168.2.2
eth1 128.193.2.2 upstream


Can anyone give me a hand here? I know a few of you are experienced with networks and programming. I've never touched perl before.

Thanks
__________________
1994 Accord EX coupe

--Need hosting for your pics on HST? PM me...--
94_AcCoRd_EX is offline   Reply With Quote
Old 04-16-2003, 01:41 AM   #2
Maxvla
 
Posts: n/a
good luck
  Reply With Quote
Old 04-16-2003, 09:18 AM   #3
spoogenet
 
Posts: n/a
Is this a school project or something???

I don't know enough about networking to be of too much assistance. I can help on a limited scale with specific perl questions, but usually I just go across the hall and get someone else to help me with the perl questions.

b
  Reply With Quote
Old 04-16-2003, 11:52 AM   #4
94_AcCoRd_EX
Insomniac Moderator
 
94_AcCoRd_EX's Avatar
 
Join Date: Aug 2001
Location: OR
Age: 43
Posts: 11,142
Quote:
Originally posted by spoogenet
Is this a school project or something???


Yeah it is :o
__________________
1994 Accord EX coupe

--Need hosting for your pics on HST? PM me...--
94_AcCoRd_EX is offline   Reply With Quote
Old 04-16-2003, 06:58 PM   #5
ebpda9
Repost Wagon
 
ebpda9's Avatar
 
Join Date: Dec 2001
Location: over here
Age: 44
Posts: 17,266
so that is under a unix/linux system right ???? well the number of ethernet devices is pretty simple to figure out: the last number +1.
__________________


ebpda9 is offline   Reply With Quote
Old 04-16-2003, 07:07 PM   #6
94_AcCoRd_EX
Insomniac Moderator
 
94_AcCoRd_EX's Avatar
 
Join Date: Aug 2001
Location: OR
Age: 43
Posts: 11,142
Quote:
Originally posted by hondaman-iac
so that is under a unix/linux system right ???? well the number of ethernet devices is pretty simple to figure out: the last number +1.


Yeah, its for *nix. I understand what you're saying, but that's assuming that the system always numbers the devices in order starting with 0. I think that's reasonable to assume, but I'll do a little research.

Its due tomorrow morning :o
__________________
1994 Accord EX coupe

--Need hosting for your pics on HST? PM me...--
94_AcCoRd_EX is offline   Reply With Quote
Old 04-16-2003, 08:22 PM   #7
ebpda9
Repost Wagon
 
ebpda9's Avatar
 
Join Date: Dec 2001
Location: over here
Age: 44
Posts: 17,266
well from what i saw on my linux system (long time ago) every device starts with 0. the pimary hdd is blah blah/hdd0 the primary slave is blah blah/hdd2 and so forth.
__________________


ebpda9 is offline   Reply With Quote
Old 04-17-2003, 09:52 AM   #8
Mushroom
 
Posts: n/a
hmm... not ethernet devices, though. I could run 2 cards on a solaris box as le0 and hme0. Count the unique IPs with your perl code to get the number of devices set. Not sure how to do so in perl, but essentially grep for "*.*.*.*", read number of lines without a comment hash before that pattern. get your output by redirecting lines from that file into another.

I think I could tcl it, but not perl.
  Reply With Quote
Old 04-17-2003, 03:04 PM   #9
94_AcCoRd_EX
Insomniac Moderator
 
94_AcCoRd_EX's Avatar
 
Join Date: Aug 2001
Location: OR
Age: 43
Posts: 11,142
I ended up using a complicated grep on /proc/net/dev to list the devices one per line. I then counted and displayed. Worked ok considering I'd never touched Perl before.
__________________
1994 Accord EX coupe

--Need hosting for your pics on HST? PM me...--
94_AcCoRd_EX is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:23 PM.


Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© 2006 HSTuners.com