LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-23-2015, 02:15 AM   #16
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477

Paste the stuff that you have tried so far and what exactly you are trying to achieve for the subnet? Basically the output you are looking for.
 
Old 03-23-2015, 03:19 AM   #17
NM04
Member
 
Registered: Jan 2011
Distribution: Back Track,Fedora,centos
Posts: 240

Original Poster
Rep: Reputation: 14
this is the code i am executing::

Code:
!/bin/sh

for (( i=1; i<=250; i++ ))
do
        for (( j=1; j<=250; j++ ))
        do
                ping -c 2 x.y.$i.$j; arp -n x.y.$i.$j; grep -v Address; grep -v incomplete >> ip-mac.txt
        done
done
the o/p I am looking for is like list of all the ip's & mac addresses in my n/w belonging to different subnets and vlans, and bind them as in the o/p of your commands so that if someone changes the ip or mac the internet access should get denied by the proxy. Your commands did the same thing but only for one subnet I want to do it for all.I thought the above script would work but apparently its not.

regards,
 
Old 03-23-2015, 04:13 AM   #18
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Here is how it should be and it works, tested it on my system:
Code:
#!/bin/sh

for i in `seq 1 10`
do
{
        for j in `seq 1 10`
        do
        {
                ping -c 1 x.y.$i.$j; arp -n x.y.$i.$j | grep -v Address | grep -v incomplete >> ip-mac.txt
        }
        done
}
done
In your script you have put semicolon at the wrong place, I have marked them in bold and red below, have a look:

Quote:
!/bin/sh

for (( i=1; i<=250; i++ ))
do
for (( j=1; j<=250; j++ ))
do
ping -c 2 x.y.$i.$j; arp -n x.y.$i.$j;grep -v Address; grep -v incomplete >> ip-mac.txt
done
done
Basically you are interrupting grep, you are asking to grep but for what? That was the problem.

Last edited by T3RM1NVT0R; 03-23-2015 at 04:15 AM.
 
Old 03-24-2015, 12:03 AM   #19
NM04
Member
 
Registered: Jan 2011
Distribution: Back Track,Fedora,centos
Posts: 240

Original Poster
Rep: Reputation: 14
ok I get it, thank you for what you have done for me. its working now.

regards,
 
Old 03-24-2015, 12:09 AM   #20
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You're welcome. Good to hear that everything is in place!

Enjoy Linux!!!
 
Old 05-08-2015, 05:59 AM   #21
NM04
Member
 
Registered: Jan 2011
Distribution: Back Track,Fedora,centos
Posts: 240

Original Poster
Rep: Reputation: 14
the last command in the series

cat squid-mac-filter.txt squid-ip-filter.txt http-access-squid.txt >> acl-final.txt
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bind IP address using MAC shipon_97 Linux - Newbie 7 08-03-2008 01:45 PM
Bind Mac with Ip address shipon_97 Linux - Newbie 5 11-23-2007 12:14 AM
Bind ip with mac address sunlinux Linux - Networking 5 08-10-2007 01:23 AM
how to bind MAC with IP sapheroth Linux - Networking 3 05-07-2007 10:40 PM
how to bind IP with MAC sapheroth Linux - Networking 5 09-19-2006 01:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration