LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 02-19-2013, 04:24 AM   #1
gdizzle
Member
 
Registered: Jul 2012
Posts: 202

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 10.10.10.1 to the client 10.10.10.100.

On the Server, this works.

Code:
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:

Code:
 
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
10.10.10.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 wlan0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0

Client Route Table:

Code:
route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.10.10.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth0
0.0.0.0         10.10.10.1      0.0.0.0         UG    0      0        0 et

Added this to the client and could not ping 192.168.1.1??

Code:
 route add -net 192.168.1.0 netmask 255.255.255.0 gw 10.10.10.1

Sorry I am confused .....

Can someone help?

Thanks
Attached Images
File Type: png localnetwork.png (10.3 KB, 12 views)
 
Old 02-19-2013, 11:05 AM   #2
wadhah102
LQ Newbie
 
Registered: Apr 2011
Location: Tunis, Tunisia
Distribution: Ubuntu/Debian/CentOS
Posts: 14

Rep: Reputation: 0
Hi,

in the side of the server:

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


Best regards

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

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....
 
  


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
Route eth2 TCP packets to tun0 with IPTABLES & IP RULE/ROUTE Thireus Linux - Networking 4 05-09-2011 12:38 PM
Default route took 20s to display with 'route' command Akhran Linux - Newbie 3 11-04-2006 04: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 04:34 AM
Masquerade: route sent us somewhere else. Palula Linux - Newbie 15 08-05-2005 06:22 AM
Route/Masquerade problem spony Linux - Networking 5 01-06-2004 09:59 AM


All times are GMT -5. The time now is 10:00 PM.

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