Visit Jeremy's Blog.
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 05-12-2005, 03:06 PM   #1
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 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
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32

Usually, people use iptables to configure NAT...
rules looks like :
WAN_IFACE = ppp0

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

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

see you...


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
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 > Forums > Linux Forums > Linux - Networking

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

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