Unfortunately and without success, i want to write a bash script who maps a known IP addess to a known MAC address using iptables and for the FORWARD chain.
Within the DHCP server, i have assigned a fixed IP address to all clients based on their MAC addresses of their network interface cards,
I have a list of the used IP addresses.
I have a list of their MAC addresses.
I dropped the FORWARD chain.
The output of the script will be such as the following:
Quote:
iptables -A FORWARD -s 192.168.0.10 -m mac --mac-source xx:xx:xx:xx:xx:xx -j ACCEPT
So far this is what i found and did, but it's very generic (192.168.0.0/24).
I want to be very specific
Then i dropped some IP's with a second script. These IP's that i'm droping are not allowed within the DHCP server.
Is there a solution in order to match these two scripts (just one script who do the work)
Thanks a lot in advance for your help
Red
---------- Post updated at 01:37 PM ---------- Previous update was at 04:32 AM ----------
Well make it simple:
if i have these 6 ip addresses: 192.168.0.10-15
Each ip address belong to nic card which has a MAC address xx:xx:xx:xx:xx:xx:xx
aa:aa:aa:aa:aa:aa:aa
........
Now, is it possible to match (map) for example 192.168.0.10 TO xx:xx:xx:xx:xx:xx using a bash script !!
Thanks for helping
Last edited by hermouche; 11-01-2017 at 03:38 PM..
Reason: Replaced quote tags with code tags
Without understanding what the request be, I'd be surprised if you could assign IPs amd MACs randomly reading from two independent files.
You should either read and use the DHCP config file, or the actual DHCP server's tables to find relations between the two.
Without understanding what the request be, I'd be surprised if you could assign IPs amd MACs randomly reading from two independent files.
You should either read and use the DHCP config file, or the actual DHCP server's tables to find relations between the two.
Thanks a lot RudiC & Scruticizer for your reply,
Well,
1- I've got all the IP addresses with their respective MAC addresses in the DHCP server
2- I can also edit a file where i got two columns, one for the IP and the other for the MAC:
Now either with the dhcp server or with the two columns file, is it possible to have at the end of the day, using a bash script something like:
How would I write a value to a physical memory address?
I was able to read a physical memory address (for example, 0x400) using this line:
dd if=/dev/mem count=4 bs=1 skip=$(( 0x400 ))
But I get an error:
dd: 'standard input': cannot skip to specified offset
when I try to write using... (1 Reply)
four interfaces with ifconfig
all interfaces have the same mac. If is not set for unique.
but it still works.
what difference does it make to have all macs the same or different? (4 Replies)
Hi Everybody,
Goal:
From my backup box on my local network, knowing the Wifi MAC address of my laptop, I would like to dynamically identify which ip address is attributed to my laptop.
The aim is to store this ip address in a local variable and that this information is retrieved by another... (11 Replies)
I am new to bash scripting. I want write a script that reads from the first argument file and run nslookup, then prints out each nslookup. Something like below:
File name = ip
8.8.8.8
8.8.4.4
Bash shell script: nslookup.sh
#!/bin/bash
for i in $1
do
nslookup $i
done
I... (7 Replies)
Hi there
I lost connectivity to one of our remote systems and when I checked the messages log I found the following:
Aug 10 23:42:34 host xntpd: time reset (step) 1.681729 s
Aug 16 13:20:51 host ip: WARNING: node "mac address" is using our IP address x.x.x.x on aggr1
Aug 16 13:20:51 host... (9 Replies)
Hi there
Im not quite sure how i can do this, but i am retrieving the mac address from boxes, which in some instances is arriving in its shortened format (i.e. dropping the leading zeros)... for example
0:3:BA:1:E:84
Im trying to figure out a way of converting the single character... (3 Replies)
Hi,
i need to replace the last octate in ipaddress with 0 using bash shell for one of my applicatiom.
googling i found the below link where they do the same thing but use long2 ip which i dont see in linux.
trim ip address octet - Stack Overflow
Plz can soemone guide how do i do this... (5 Replies)
Hi
I need to write a bash shell script. I have two separate text files. One file contains a list of MAC addresses taken from a network scan, the other contains a list of MAC addresses for our currently-managed devices. How can I compare these two files, and output a list of addresses that have... (6 Replies)
Hi sir,
i want to make such programe which takes MAC(Ethernet) address of any host & give me its IP address.......
but i'm nt getting that how i can pass the MAC address to Frame........
Please give me an idea for making such program...
Thanks & regards
Krishna (3 Replies)