LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 05-12-2005, 03:06 PM   #1
warwolf
LQ Newbie
 
Registered: May 2005
Location: Sweden
Distribution: Kubuntu 11.04
Posts: 10

Rep: Reputation: 0
Help with iproute2


I have a linux machine i want to use as a nat router got 2 nic:s one for my internal lan (eth1) with ip 192.168.0.1/24 it runs a dhcp server so all computers on my lan get an 192.168.0.x address. The other card (eth0) is connected to my dsl-modem and get it's ip 'y.y.y.y' by dhcp. No i want to nat all my computers inside this lan.
As i understand i should use
"ip route add nat" and "ip rule add nat" then flush the cache to be sure it use my new routings, but for some reasons i can't get this to work.

/thanks in advance - WarWolf

Last edited by warwolf; 05-12-2005 at 03:10 PM.
 
Old 05-13-2005, 09:25 AM   #2
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Hi,

Usually, people use iptables to configure NAT...
rules looks like :
WAN_IFACE = ppp0
SOURCE_IP = 192.168.0.0/24
PUBLIC_IP = xxx.xxx.xxx.xxx

iptables -t nat -A POSTROUTING -s $SOURCE_IP -o $WAN_IFACE -j SNAT --to-source $PUBLIC_IP
or
iptables -t nat -A POSTROUTING -s $SOURCE_IP -o $WAN_IFACE -j MASQUERADE

The second one is to be used when you get a dynamic IP from your ISP : it automatically nats the pakets to the IP of the output interface.

For more info on iptables, have a look at http://www.linuxsecurity.com/resourc...-tutorial.html

see you...
 
  


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
problem in iproute2 alvi2 Linux - Networking 1 06-13-2005 06:13 PM
iproute2 package Ipolit Slackware 1 12-12-2004 08:40 AM
Problem installing iproute2 greklas Linux - Networking 2 10-21-2004 07:39 AM
iproute2 rounting sqn Linux - Networking 1 06-14-2004 02:26 PM
installing iproute2 lwinkenb Linux From Scratch 2 04-12-2004 02:05 PM

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

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