LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-27-2013, 04:52 PM   #1
NotAComputerGuy
Member
 
Registered: Jun 2012
Distribution: Linux Mint - Debian Edition
Posts: 349

Rep: Reputation: 13
IPTables


I've tried to read as much as I can about firewalls and I think iptables can do what I want to do.

I want to ensure that transmission doesn't send traffic out through eth0 and only tun0.

I copied the following from a website which was talking about doing what I want to do:
Code:
sudo iptables -A OUTPUT -m owner --uid-owner debian-transmission -d 192.168.0.100 -j ACCEPT
which works, but now I can't connect in to Transmission.

Also, how can I do similar, but use a program name instead of --uid-owner to ensure that Firefox and other programs don't go over the VPN?

Thanks
 
Old 07-27-2013, 11:16 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,469

Rep: Reputation: Disabled
You can use firewall rules to prevent certain types of traffic from going out a certain interface, but that doesn't mean the packets will be automatically redirected to another interface.

Gateways/interfaces are selected based on information in the routing table, not by firewall rules. What you need is policy routing.

(The iptables "owner" match is deprecated, by the way.)
 
Old 07-28-2013, 03:10 AM   #3
NotAComputerGuy
Member
 
Registered: Jun 2012
Distribution: Linux Mint - Debian Edition
Posts: 349

Original Poster
Rep: Reputation: 13
Is that where stuff like:
Code:
route add -net 10.0.0.0 netmask 255.0.0.0 dev tun0
comes into it?
 
Old 07-28-2013, 07:11 AM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,469

Rep: Reputation: Disabled
It is, but as you can see, a route command has no reference to origin or type of traffic, just the destination.

route manipulates the main routing table. The ip route command, however, can create a number of alternate routing tables. You can then use iptables to "mark" packets of a certain type, and finally tie it all together by creating an IP rule (with the ip rule command) that says "packets marked with X should be processed by routing table Y".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables can't initialize iptables table `filter': Bad file descriptor donalbane Linux - Networking 2 08-17-2011 09:36 AM
iptables error in android: iptables-save and iptables-restore not working preetb123 Linux - Mobile 5 04-11-2011 02:56 PM
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 09:20 PM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 07:08 AM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 08:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration