Quote:
Originally Posted by
RudiC
Sorry I'm not too familiar with iptables - did you try to just execute the two lines? Redirect into a temporary file, and then source that in your root shell.
YES exactly i want to execute these two lines hopefully -
If i launch manually the two lines (one by one) it will do the work.
So now how to include them into the bash script !!!
I Think you got my point.
How to redirect into a temporary file, and then source the root shell ?
Thanks again RudiC.
---------- Post updated 11-03-17 at 09:57 AM ---------- Previous update was 11-02-17 at 10:31 AM ----------
Hy everybody an RudiC
I am bothering you but i want to learn from you. Just newbee to scripting
So far, with the big help of "RudiC", i got the script and it works just fine, thanks again "RudiC"
This is what i've done but seem's not professional at all !!!
Quote:
#!/bin/bash
# I should at first create a file which has two columns : one for IP addresses and the second the corresponding MAC address . The file is called "ipmacmap".
# Create an executable file called "forward.sh"
echo '#!/bin/bash' > forward.sh
chmod +x forward.sh
# Lauching the following command will edit the previous "forward.sh" with forwarding rules for evey corresponding IP vs MAC address from "ipmacmap"
sed 's/ / -p tcp -m multiport --dports 110,143,25,465,585,993,995,80,443 -m mac --mac-source /; s/^/iptables -I FORWARD -s /; s/$/ -j ACCEPT/' ipmacmap >> forward.sh
# Applying the forward rules
./forward.sh
# Check the rules
iptables -L FORWARD --line-numbers
How to be more professional !
Is it possible to include the file "ipmacmap" inside the script?
Any other ideas are welcomed
Thanks for helping me.
Red