LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-29-2005, 06:27 AM   #1
Tomanas
LQ Newbie
 
Registered: May 2005
Posts: 22

Rep: Reputation: 15
NAT'ing an IP


Hi!
I want to nat the ip x.x.x.x to 192.168.0.y.
I wrote a script and put these lines:
Code:
$IPTABLES -t nat -I PREROUTING -d x.x.x.x -j DNAT --to-destination 192.168.0.y
$IPTABLES -t nat -I POSTROUTING -s 192.168.0.y -d ! 192.168.0.0/23 -j SNAT --to-source x.x.x.x
$IPTABLES -I FORWARD -d 192.168.0.y -j ACCEPT
$IPTABLES -I FORWARD -s 192.168.0.y -j ACCEPT
Then I restart iptables, but it is still not working...when i ping 192.168.0.y - I get a reply, but if i ping the x.x.x.x - destination host unreachable...
What could it be ?
 
Old 10-30-2005, 12:47 AM   #2
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
You want to forward ports from outside your network to machines inside your network, routing IPs won't work.

iptables -t nat -A PREROUTING -i $EXT_DEV -p tcp -m tcp --dport 800 -j DNAT --to-destination 192.168.1.7:800

Last edited by mdarby; 10-30-2005 at 12:48 AM.
 
Old 04-26-2006, 06:14 AM   #3
Tomanas
LQ Newbie
 
Registered: May 2005
Posts: 22

Original Poster
Rep: Reputation: 15
now, u're wrong anyway, i have done it a few days earlier..
 
Old 04-26-2006, 09:07 AM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8118Reputation: 8118Reputation: 8118Reputation: 8118Reputation: 8118Reputation: 8118Reputation: 8118Reputation: 8118Reputation: 8118Reputation: 8118Reputation: 8118
Tomanas is right, this can be done.

Are you missing an INPUT rule?
Code:
$IPTABLES -I INPUT -p ALL -d x.x.x.x -j ACCEPT
Eric
 
  


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
NAT'ing RC.FIREWALL Script & Port Forwarding Bittorrent wlfdgcrkz Linux - Networking 2 08-24-2004 11:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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