Sample Header Ad - 728x90

Why does including --opcode command in arptables work on wifi router 1 but not on wifi router 2

1 vote
0 answers
17 views
I have a shell script on my linux computer that has these arptables command;
$ cat arptables.sh

mac_address="AA:BB:CC:DD:EE:FF"

arptables -P INPUT DROP
arptables -P OUTPUT DROP

arptables -A INPUT --opcode Request -d 0.0.0.0 -j DROP
arptables -A INPUT --opcode Reply -d 0.0.0.0 -j DROP
arptables -A INPUT --opcode Request -j DROP

arptables -A INPUT -s 192.168.3.1 --source-mac "$mac_address" -j ACCEPT
arptables -A OUTPUT -d 192.168.3.1 -j ACCEPT
Then I added this script at system startup of my PC and it works fine with my previous wifi router. Now, I recently bought a new wifi router and changed the mac_address part of the code to match my new router and it fails to connect to the internet. All my other devices can connect to the internet, since this script isn't running on those devices. Then I removed the opcode portions from the script above and everything worked fine for the new wifi router. However, on the previous router, this entire script works just fine. Would anyone explain what is this opcode part. I read on an article couple years back that opcode could prevent spoofing mac addresses so they suggested this code. So I added the opcode portion to my script.
Asked by learningregularexpressions (53 rep)
Mar 19, 2025, 04:53 PM
Last activity: Mar 19, 2025, 10:46 PM