LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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-29-2007, 08:22 PM   #1
SekurityKlown
LQ Newbie
 
Registered: Nov 2005
Posts: 2

Rep: Reputation: 0
eth0 -> wlan0 IPtables entry not working


Sorry to post such a "beatin to death" topic but I just cannot get this to work. All I want to do is forward traffic from eth0 to wlan0. They are both interfaces on my laptop. My PS3 is whats connected to the eth0 with crossover cable. Wlan0 is my connection to my wireless linksys router which is connected to my cable modem. Yes /proc/sys/net/ipv4/ip_forward = 1, its set at boot time.

192.168.0.2(ps3)<-->192.168.0.1(eth0)<laptop>(wlan0)192.168.1.3 >>>>> <192.168.1.1(router)>


rc.firewall:

#!/bin/sh
# Basic firewall and forward/masquerade setup

PATH=/usr/sbin:/sbin:/bin:/usr/bin

# Delete/Flush old iptables rules
iptables -F
iptables -t nat -F
iptables -X

iptables -t nat -A POSTROUTING -o wlan0 -s 192.168.0.0/24 -j MASQUERADE

route -n:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0

I know the gateway route for eth0 is missing. Its because I've been trying different ones with no luck. What am I missing here? Do have to run a DNS on my gateway? Set some more routes? After all the trial and error, posting for help is my last resort.

Last edited by SekurityKlown; 07-29-2007 at 08:30 PM.
 
Old 07-30-2007, 05:42 AM   #2
SekurityKlown
LQ Newbie
 
Registered: Nov 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Fixed!! ^_^ Seems the routing table is fine just the way its shown above. I was testing it different gateways for eth0. So that route table and this rc.firewall:

#!/bin/sh
# Basic firewall and forward/masquerade setup

PATH=/usr/sbin:/sbin:/bin:/usr/bin

# Delete/Flush old iptables rules
iptables -F
iptables -t nat -F
iptables -X

# Set up IP FORWARDing and Masquerading
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE

echo "1" > /proc/sys/net/ipv4/ip_forward

works just fine.

Last edited by SekurityKlown; 07-30-2007 at 02:02 PM.
 
  


Reply

Tags
eth0, iptables, masquerade, wlan0


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
wlan0 doesn't work without eth0? linuxhippy Fedora 8 07-26-2005 07:43 PM
Remapping wlan0 to eth0 Berhanie Linux - Networking 1 02-17-2005 07:59 AM
Eth0 to WLAN0 how do i rename it? XeoNoX Linux - Wireless Networking 5 02-22-2004 05:54 AM
Starting wlan0 instead of eth0 eo697 Linux - Networking 2 10-12-2003 05:02 PM
route wlan0 to eth0 hwood7587 Linux - Networking 1 07-13-2003 06:47 PM


All times are GMT -5. The time now is 04:52 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration