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


  Search this Thread
Old 02-19-2013, 05:24 AM   #1
Registered: Jul 2012
Posts: 233

Rep: Reputation: Disabled
ip route or route alternative to ip masquerade

Hi All,
Basic home network I have attached a small diagram.

Situation is, I always use iptables to masquerade the internet connection (wlan0) from the server to the client

On the Server, this works.

iptables -A POSTROUTING -t nat -o wlan0 -j MASQUERADE

However I am trying to learn route or ip route and I am looking to route the internet packets from the server to the client, using the "route" or "ip route" command.

Below are the details:

Server Route Table:

route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface   U     0      0        0 wlan0   U     0      0        0 eth0     U     1002   0        0 eth0     U     1003   0        0 wlan0         UG    0      0        0 wlan0

Client Route Table:

route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface   U     0      0        0 eth0     U     1003   0        0 eth0         UG    0      0        0 et

Added this to the client and could not ping

 route add -net netmask gw

Sorry I am confused .....

Can someone help?

Attached Thumbnails
Click image for larger version

Name:	localnetwork.png
Views:	12
Size:	10.3 KB
ID:	11894  
Old 02-19-2013, 12:05 PM   #2
LQ Newbie
Registered: Apr 2011
Location: Tunis, Tunisia
Distribution: Ubuntu/Debian/CentOS
Posts: 14

Rep: Reputation: 0

in the side of the server:

iptables -t nat -A PREROUTING -p ALL -i wlan0 -j DNAT --to-destination
iptables -I FORWARD -p ALL -i wlan0 -o eth0 -d -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I FORWARD -p ALL -i eth0 -o wlan0 -s -m state --state ESTABLISHED -j ACCEPT

Best regards

Last edited by wadhah102; 02-19-2013 at 03:04 PM. Reason: change
Old 02-19-2013, 04:42 PM   #3
Registered: Jul 2012
Posts: 233

Original Poster
Rep: Reputation: Disabled
Hi Wadhah102,
I am trying to NOT use iptables and USE the route or the ip route command to forward the packets....


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
Route eth2 TCP packets to tun0 with IPTABLES & IP RULE/ROUTE Thireus Linux - Networking 4 05-09-2011 01:38 PM
Default route took 20s to display with 'route' command Akhran Linux - Newbie 3 11-04-2006 05:59 AM
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 05:34 AM
Masquerade: route sent us somewhere else. Palula Linux - Newbie 15 08-05-2005 07:22 AM
Route/Masquerade problem spony Linux - Networking 5 01-06-2004 10:59 AM

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

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