LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-07-2011, 03:15 PM   #1
ryanmission
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Rep: Reputation: 0
iptables and NAT in Ubuntu 10


Hey, i have a basic box running Ubuntu 10.10 - command line only, and i believe it's a "light weight" version as i was originally trying to install Lubuntu but never got around to it.

Anyways, it's installed and boots from a 4GB usb stick and everything seems to be running good.

Im starting from scratch, so i dont have any specific rules yet...however this is what im starting with:

eth0 = WAN (public ip)
eth2 = LAN (private ip - 192.168.1.1/24)

*default config of iptables unless otherwise stated*
iptables -P INPUT ACCEPT - set to accept to allow me to SSH to this box [temp]
iptables -P OUTPUT ACCEPT - set to accept to allow me to SSH to this box [temp]
iptables -P FORWARD DROP

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

sudo iptables -A FORWARD -s 192.168.1.0/24 -d 0.0.0.0/0 -o eth0 -j ACCEPT
sudo iptables -A FORWARD -s 0.0.0.0/0 -d 192.168.1.0/24 -i eth0 -j ACCEPT

This should technically be all i have to do to enable NAT on my WAN interface, correct?

Note: i have not yet explicitly "modprobe"'d anything, such as ip_conntrack, etc...this is running from boot.
Note2: i have tried modprobing a few things, nothing worked
Note3: there is a default route sending packets out the WAN interface
Note3: the packets are not being translated, despite my rules. the firewall will send 192.168.x.x addresses out the WAN interface un-translated...and obviously being dropped once it hits my ISP's first router.

Verified using wireshark / tcpdump

Any help would be useful...thanks!!
 
Old 03-07-2011, 04:13 PM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Did you enabled in kernel option for routing packets? By default it is disabled.
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
 
  


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
iptables and NAT gardenair Linux - Newbie 2 12-02-2010 12:42 AM
iptables: can't initialize iptables table `NAT' linuxgentoo Linux - Kernel 3 01-17-2010 10:15 AM
Iptables nat keyboard1973 Linux - Newbie 1 12-17-2008 06:30 AM
IPtables and NAT CoffeeKing!!! Linux - Networking 2 03-24-2008 06:39 PM
IPTABLES : build NAT using IPTABLES joseph Linux - Networking 4 04-23-2004 05:08 AM

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

All times are GMT -5. The time now is 12:11 AM.

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