LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices


Reply
  Search this Thread
Old 05-21-2015, 02:11 PM   #1
scotthill
LQ Newbie
 
Registered: Jan 2009
Posts: 25

Rep: Reputation: 15
Routing traffic to wlan0 hotspot server using iptables - troubles


I have a wifi hotspot that serves a web page from a local server to mobile devices that connect to the hotspot. When any http://domain.com is called I want the file server on the resident server to respond. The following iptables line works to do that (if eth0 router connected).

iptables -t nat -A PREROUTING -s 192.168.150.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 4444

The line in the iptables works if at boot the eth0 cables is plugged in and gets set up by a ethernet router. Actually, it starts working if the ethernet cable is plugged in at anytime after booting and it works thereafter even if the cable is disconnected. I don't understand why that should cause the wlan0 traffic to not route properly. The route table looks the same when working after disconnecting the eth0 router as it does on a boot without eth0.

Without the eth0 connected to a router the wlan0 clients asking for 192.168.150.1:4444 works but some http://whatever.com name does not. However with a router connected (once after boot) to eth0 then if a client asks for http://whatever.com will have the request forwarded to 192.168.150.1:4444

What can I do to make this work without an eth0 connection?
 
Old 05-24-2015, 10:53 AM   #2
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Add the following;

Code:
 -i wlan0
This tell iptables which interface to apply the rule to.
 
  


Reply

Tags
hotspot, iptables, redirect, routing, wifi


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: All routing on any interface seems to stop when a rule for wlan0 is added iwonbigbro Linux - Security 4 10-11-2012 09:23 AM
Routing return traffic based on the NIC of the incoming traffic? adamk75 Linux - Networking 3 12-11-2011 04:27 AM
Routing traffic to pass through a server in a different location osunlade Linux - Networking 3 11-03-2011 11:00 PM
[SOLVED] IPtables&routing on an Untangle box, need some advice, traffic not being returned scheidel21 Linux - Networking 3 09-02-2010 08:57 AM
Routing incoming traffic to NAT'ed VM on a hired dedicated server merlininthewood Linux - Networking 2 05-21-2010 03:30 PM

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

All times are GMT -5. The time now is 10:53 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