Networking Forums

Networking Forums > Computer Networking > Linux Networking > remapping ip addresses: how?

Reply
Thread Tools Display Modes

remapping ip addresses: how?

 
 
Alessandro Russo
Guest
Posts: n/a

 
      09-06-2006, 03:22 PM
Hi,

sorry if the question is silly for thus ng, but I have already
tried to answer for the whole day without results.

I need a way to remap an IP address to another, in such a way that
all the traffic directed to, say, 1.2.3.4, will go to 10.20.30.40.

In particular, 1.2.3.4 is an external ip while 10.20.30.40 is my
local ip.

In other words, I need a way to specify that the traffic directed
to a certain external ip will instead be routed to my local ip.

I have Fedora Core 5.

Thanks in advance for any help.

Alessandro
 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      09-06-2006, 03:34 PM
On 2006-09-06, Alessandro Russo <(E-Mail Removed)> wrote:
> I need a way to remap an IP address to another, in such a way that
> all the traffic directed to, say, 1.2.3.4, will go to 10.20.30.40.


Yes, that's commonly called 'NAT' or Network Address Translations,
see the IPTable documentation for DNAT (Destination NAT)

Davide

--
"I'm not lean and mean, I'm surly and anorexic".
-- Chris "Saundo" Saunderson on alt.sysadmin.recovery
 
Reply With Quote
 
Alessandro Russo
Guest
Posts: n/a

 
      09-06-2006, 06:51 PM
Davide Bianchi wrote:
> On 2006-09-06, Alessandro Russo <(E-Mail Removed)> wrote:
>> I need a way to remap an IP address to another, in such a way that
>> all the traffic directed to, say, 1.2.3.4, will go to 10.20.30.40.

>
> Yes, that's commonly called 'NAT' or Network Address Translations,
> see the IPTable documentation for DNAT (Destination NAT)
>


I have tried, but I don't understand what I have to do.
I tried what I found at

http://openskills.info/topic.php?ID=125

but no way.

Any hints? Thanks again.

Ale
 
Reply With Quote
 
Michael Heiming
Guest
Posts: n/a

 
      09-06-2006, 07:34 PM
In comp.os.linux.networking Alessandro Russo <(E-Mail Removed)>:
> Davide Bianchi wrote:
>> On 2006-09-06, Alessandro Russo <(E-Mail Removed)> wrote:
>>> I need a way to remap an IP address to another, in such a way that
>>> all the traffic directed to, say, 1.2.3.4, will go to 10.20.30.40.


>> Yes, that's commonly called 'NAT' or Network Address Translations,
>> see the IPTable documentation for DNAT (Destination NAT)


> I have tried, but I don't understand what I have to do.
> I tried what I found at



The "Linux Home Server HOWTO" looks exactly like what you want
and was updated to suit FC 5:

http://www.brennan.id.au/

As already mentioned "Destination NAT" is what you want, not that
I have ever used this document but it seems from a short look
well written.

I'd urge you to check the chapter about yum, you can ease up
installing/updating software pretty much if using 'yum'!

Good luck

[..]

--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo (E-Mail Removed) | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 455: This code passes Torvalds test grades 0,
1 and 2 (looks ok, compiles and boots).
 
Reply With Quote
 
Alessandro Russo
Guest
Posts: n/a

 
      09-06-2006, 09:01 PM
Michael Heiming wrote:
> In comp.os.linux.networking Alessandro Russo <(E-Mail Removed)>:
>> Davide Bianchi wrote:
>>> On 2006-09-06, Alessandro Russo <(E-Mail Removed)> wrote:
>>>> I need a way to remap an IP address to another, in such a way that
>>>> all the traffic directed to, say, 1.2.3.4, will go to 10.20.30.40.

>
>>> Yes, that's commonly called 'NAT' or Network Address Translations,
>>> see the IPTable documentation for DNAT (Destination NAT)

>
>> I have tried, but I don't understand what I have to do.
>> I tried what I found at

>
>
> The "Linux Home Server HOWTO" looks exactly like what you want
> and was updated to suit FC 5:
>
> http://www.brennan.id.au/
>
> As already mentioned "Destination NAT" is what you want, not that
> I have ever used this document but it seems from a short look
> well written.
>
> I'd urge you to check the chapter about yum, you can ease up
> installing/updating software pretty much if using 'yum'!
>


I tried

iptables -t nat -A PREROUTING -d 1.2.3.4 -j DNAT --to-destination 10.20.30.40

with no effects.

As far I understood, this should redirect to 10.20.30.40 everything that
was originally directed to 1.2.3.4. Or I'm wrong?

Ale
 
Reply With Quote
 
Michael Heiming
Guest
Posts: n/a

 
      09-06-2006, 10:11 PM
In comp.os.linux.networking Alessandro Russo <(E-Mail Removed)>:
> Michael Heiming wrote:
>> In comp.os.linux.networking Alessandro Russo <(E-Mail Removed)>:
>>> Davide Bianchi wrote:
>>>> On 2006-09-06, Alessandro Russo <(E-Mail Removed)> wrote:
>>>>> I need a way to remap an IP address to another, in such a way that
>>>>> all the traffic directed to, say, 1.2.3.4, will go to 10.20.30.40.


>>>> Yes, that's commonly called 'NAT' or Network Address Translations,
>>>> see the IPTable documentation for DNAT (Destination NAT)


>>> I have tried, but I don't understand what I have to do.
>>> I tried what I found at



>> The "Linux Home Server HOWTO" looks exactly like what you want
>> and was updated to suit FC 5:


>> http://www.brennan.id.au/


> I tried


> iptables -t nat -A PREROUTING -d 1.2.3.4 -j DNAT --to-destination 10.20.30.40


> with no effects.


> As far I understood, this should redirect to 10.20.30.40 everything that
> was originally directed to 1.2.3.4. Or I'm wrong?


There is more then a single command needed and I can't look into
your box. Did you worked through the documentation I pointed out
to you?

You can see your nat setup with '/sbin/iptables -t nat -nvL',
again all this is in the howto, you just need to work trough it.

Good luck

--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo (E-Mail Removed) | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 435: Internet shut down due to maintenance
 
Reply With Quote
 
Alessandro Russo
Guest
Posts: n/a

 
      09-06-2006, 10:28 PM
Michael Heiming wrote:
> In comp.os.linux.networking Alessandro Russo <(E-Mail Removed)>:
>> Michael Heiming wrote:
>>> In comp.os.linux.networking Alessandro Russo <(E-Mail Removed)>:
>>>> Davide Bianchi wrote:
>>>>> On 2006-09-06, Alessandro Russo <(E-Mail Removed)> wrote:
>>>>>> I need a way to remap an IP address to another, in such a way that
>>>>>> all the traffic directed to, say, 1.2.3.4, will go to 10.20.30.40.

>
>>>>> Yes, that's commonly called 'NAT' or Network Address Translations,
>>>>> see the IPTable documentation for DNAT (Destination NAT)

>
>>>> I have tried, but I don't understand what I have to do.
>>>> I tried what I found at

>
>
>>> The "Linux Home Server HOWTO" looks exactly like what you want
>>> and was updated to suit FC 5:

>
>>> http://www.brennan.id.au/

>
>> I tried

>
>> iptables -t nat -A PREROUTING -d 1.2.3.4 -j DNAT --to-destination 10.20.30.40

>
>> with no effects.

>
>> As far I understood, this should redirect to 10.20.30.40 everything that
>> was originally directed to 1.2.3.4. Or I'm wrong?

>
> There is more then a single command needed and I can't look into
> your box. Did you worked through the documentation I pointed out
> to you?
>
> You can see your nat setup with '/sbin/iptables -t nat -nvL',
> again all this is in the howto, you just need to work trough it.
>


sbin/iptables -t nat -nvL says:

Chain PREROUTING (policy ACCEPT 1607 packets, 84568 bytes)
pkts bytes target prot opt in out source destination
0 0 DNAT all -- * * 0.0.0.0/0 149.132.103.59

to:1.60.153.33

where "to:1.60.153.33" is on the right of 149.132.103.59.

It seems ok to me, but it should be wrong.

Ale



 
Reply With Quote
 
Michael Heiming
Guest
Posts: n/a

 
      09-06-2006, 11:15 PM
In comp.os.linux.networking Alessandro Russo <(E-Mail Removed)>:
> Michael Heiming wrote:
>> In comp.os.linux.networking Alessandro Russo <(E-Mail Removed)>:
>>> Michael Heiming wrote:
>>>> In comp.os.linux.networking Alessandro Russo <(E-Mail Removed)>:
>>>>> Davide Bianchi wrote:
>>>>>> On 2006-09-06, Alessandro Russo <(E-Mail Removed)> wrote:
>>>>>>> I need a way to remap an IP address to another, in such a way that
>>>>>>> all the traffic directed to, say, 1.2.3.4, will go to 10.20.30.40.


>>>>>> Yes, that's commonly called 'NAT' or Network Address Translations,
>>>>>> see the IPTable documentation for DNAT (Destination NAT)


>>>>> I have tried, but I don't understand what I have to do.
>>>>> I tried what I found at


>>>> The "Linux Home Server HOWTO" looks exactly like what you want
>>>> and was updated to suit FC 5:


>>>> http://www.brennan.id.au/

[..]

> sbin/iptables -t nat -nvL says:


> Chain PREROUTING (policy ACCEPT 1607 packets, 84568 bytes)
> pkts bytes target prot opt in out source destination
> 0 0 DNAT all -- * * 0.0.0.0/0 149.132.103.59


> to:1.60.153.33


> where "to:1.60.153.33" is on the right of 149.132.103.59.


> It seems ok to me, but it should be wrong.


It seems wrong to me. Please start reading and using the "Linux
Home Server HOWTO" now!

http://www.brennan.id.au/

--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo (E-Mail Removed) | perl -pe 'y/a-z/n-za-m/'
#bofh excuse 465: Fatal Error: Found [MS-Windows] System ->
Repartitioning disk for Linux...
 
Reply With Quote
 
Pascal Hambourg
Guest
Posts: n/a

 
      09-07-2006, 01:03 AM
Hello,

Alessandro Russo a écrit :
>
> I need a way to remap an IP address to another, in such a way that
> all the traffic directed to, say, 1.2.3.4, will go to 10.20.30.40.
>
> In particular, 1.2.3.4 is an external ip while 10.20.30.40 is my
> local ip.
>
> In other words, I need a way to specify that the traffic directed
> to a certain external ip will instead be routed to my local ip.


Try :

iptables -t nat -A OUTPUT -d 1.2.3.4 -j DNAT --to 10.20.30.40

The OUTPUT chain sees locally generated packets whereas PREROUTING sees
incoming packets.
 
Reply With Quote
 
Alessandro Russo
Guest
Posts: n/a

 
      09-07-2006, 08:12 AM
Pascal Hambourg wrote:
> Hello,
>
> Alessandro Russo a écrit :
>>
>> I need a way to remap an IP address to another, in such a way that
>> all the traffic directed to, say, 1.2.3.4, will go to 10.20.30.40.
>>
>> In particular, 1.2.3.4 is an external ip while 10.20.30.40 is my
>> local ip.
>>
>> In other words, I need a way to specify that the traffic directed
>> to a certain external ip will instead be routed to my local ip.

>
> Try :
>
> iptables -t nat -A OUTPUT -d 1.2.3.4 -j DNAT --to 10.20.30.40
>
> The OUTPUT chain sees locally generated packets whereas PREROUTING sees
> incoming packets.


Thanks a lot, it worked.

Ale
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Port remapping Alex B. Windows Networking 3 03-17-2008 08:35 AM
What are 127.x.x.x addresses? Legend Linux Networking 17 01-07-2008 08:03 PM
DHCP Server Leasing Addresses to MAC Addresses of 00-00-00-00-00-00 nomorespameventhoughthejapanesespamgivesmeachuckle Linux Networking 9 12-05-2006 09:49 PM
Remapping a share using DNA and CName records... HOW? Fran Windows Networking 1 12-23-2005 01:44 AM
Static Ip's and BT - I have just recieved A BT router with 5 static IP Addresses. However, I want 5 computers in the office to use only one of the addresses. ery Difficult Question Nattasian Broadband 3 07-13-2004 08:55 AM



1 2 3 4 5 6 7 8 9 10 11