Find the answer to your Linux question:
Results 1 to 4 of 4
I've got a desktop with two NICS eth0 & eth1. eth0 has an ip and is the in/out access to the desktop. eth1 has no ip, it is listening to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    27

    iptables drop output on given interface


    I've got a desktop with two NICS eth0 & eth1. eth0 has an ip and is the in/out access to the desktop. eth1 has no ip, it is listening to traffic coming in from a cable modem. I want to use iptables to drop all output packets from this interface and allow output from eth1 but when I try:
    Code:
    iptables -A OUTPUT -i eth1 -j DROP
    I get the error, "iptables v1.2.11: Can't use -i with OUTPUT"

    So, I figure that I could set the default output policy to DROP and then allow output from the ip given to eth0. Is this gonna work and is it a feasible solution?

  2. #2
    Just Joined!
    Join Date
    Oct 2008
    Posts
    27

    follow up

    Well, that didnt work. If I set OUTPUT default policy to drop than I can't set the loopback interface OUTPUT policy to accept and I get weird errors when restarting the desktop. Trying to set lo's output to accept gives me the same error as before.

    Any help?

  3. #3
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    That should be

    Code:
    iptables -A OUTPUT -o eth1 -j DROP
    Loopback can be setup as follows:

    Code:
    iptables -A INTPUT -i lo -j ACCEPT
    iptables -A OUTPUT -o lo -j ACCEPT

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Oct 2008
    Posts
    27

    thanks

    Thanks,

    didnt know about the -o, just looked it up in man iptables (something I should of done first I guess) and now it makes sense

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •