"Bad argument" when I try to set a iptables command

14,385

You should try this command in this form:

sudo /usr/sbin/iptables -A INPUT -m state --state NEW ! -i wlan0 -j ACCEPT

But be sure, that interface wlan0 is up:

sudo ifconfig wlan0 up

Share:
14,385

Related videos on Youtube

Mr_LinDowsMac
Author by

Mr_LinDowsMac

Updated on September 18, 2022

Comments

  • Mr_LinDowsMac
    Mr_LinDowsMac over 1 year

    I'm trying to run the following command:

    sudo /usr/sbin/iptables -A INPUT -m state --state NEW -i ! wlan0 -j ACCEPT
    

    But i got this error:

    Bad argument wlan0' Tryiptables -h' or 'iptables --help' for more information.

    I don't know what is wrong, the man says that you have to put a "!" before the conection adapter (in this case is wlan0)

    • user9517
      user9517 over 11 years
      What are you actually trying to achieve ?
    • Mr_LinDowsMac
      Mr_LinDowsMac over 11 years
    • Mr_LinDowsMac
      Mr_LinDowsMac over 11 years
      I'm trying to resolve the problem posted here: serverfault.com/questions/417729/…
    • user9517
      user9517 over 11 years
      Your question is off topic for Serverfault because it doesn't appear to relate to servers/networking or desktop infrastructure in a professional environment. It may be on topic for Superuser but please search their site for similar questions that may already have the answer you're looking for. It may also be on topic for raspberrypi.stackexchange.com
    • Mr_LinDowsMac
      Mr_LinDowsMac over 11 years
      Ok, i'll post it there.
  • Mr_LinDowsMac
    Mr_LinDowsMac over 11 years
    I applied the rule but didn't fix my problem