LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 03-22-2004, 09:55 AM   #31
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50

to make your linux to be router, edit /etc/sysctl.conf and change the following line:
net.ipv4.ip_forward = 1

now its a router. if u change the gw of clients to linux, they will be able to access other networks which linux can access.

then give some iptables command to make NAT. an example:

iptables -t nat -A POSTROUTING -s 172.0.0.0/255.255.0.0 -d ! 192.168.0.0/255.255.255.0 -j SNAT --to 212.145.7.8

this makes nat if the source ip come from 172.0.0.0/255.255.0.0 network and the destinations is not 192.168.0.0/255.255.255.0.. static public ip: 212.145.7.8, change it for your real static ip. if u dont have static ip, u have to use "masquerade" like this:

iptables -t nat -A POSTROUTING -o ppp0 -s 172.0.0.0/255.255.0.0 -d ! 192.168.0.0/255.255.255.0 -j MASQUERADE

the interface which s connected to internet is ppp0. if its a ethernet, change it.
 
  


Reply



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
Routing question jeffvph Linux - Networking 2 11-07-2005 07:14 PM
routing question jeffvph Linux - Networking 9 07-24-2005 07:09 PM
routing question hsegtreas Linux - Networking 2 08-28-2004 05:19 PM
routing question gubak Linux - Newbie 1 07-23-2004 02:41 AM
Routing Question brokenflea Linux - Networking 2 12-05-2003 03:15 PM

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

All times are GMT -5. The time now is 12:26 PM.

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