LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-16-2013, 02:45 AM   #1
altaf123
LQ Newbie
 
Registered: Jul 2013
Posts: 1

Rep: Reputation: Disabled
Route all traffic to Loopback with iptables


Hello ALL.......!

I am trying to redirect the traffic on the tun0 interface to loopback and I request you to guide me.

I have a tun0 interface and a when a client with an IP of 192.168.254.2 (coming from tun0) wants to access the Internet I do

$ iptables -A POSTROUTING -s 192.168.254.2 -t nat -o wlan0 -j MASQUERADE

and the client successfully connects to the Internet over WIFI.


Now instead of wlan0 I want to redirect all traffic coming from tun0 to Loopback on which I am running a BIND DNS server and also a lighttpd Webserver. I tried with few rules but failed to do so. Can you guide me with the right rule.

regards,

Altaf
 
Old 07-16-2013, 01:37 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
First of all.. STOP


You dont want to route your traffic to your loopback device, ever.


So please explain here a little more about what you are trying to accomplish. You mention you have BIND and lighthttpd running so is it just your goal to have DNS lookups go to your internal BIND server first before going to internet? Which would then have a DNS record your internal website running of lighthttpd making it accessible from the client web browser?

It sounds like this is the case, and you will want to make changes to your /etc/resolv.conf to point to your loopback/systems IP so dns lookups go to your local BIND server, you also need to make sure you have your "Forwarders" set up so that any dns requests that are not on your local BIND server get forwarded to your ISP nameservers. Then just make sure you have a zone file on your local BIND server for your site(s) running on lighthttpd and you're set.
 
  


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
how to route the configured loopback interfce in debian ? dr.x Linux - Server 7 05-29-2013 08:07 PM
IPtables: Route outgoing traffic from internal host to only go a internet interface predatorz Linux - Networking 4 11-24-2010 10:05 AM
iptables loopback local traffic with masc? jfuerst Linux - Networking 1 03-22-2010 08:49 PM
iptables command to route all incoming traffic ger88005 Linux - Networking 2 02-11-2008 10:40 AM
sending out going traffic to the loopback interface with iptables hypexr Linux - Networking 1 09-22-2005 08:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:15 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
Open Source Consulting | Domain Registration