Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Servers & Networking
FedoraForum Search

Forgot Password? Join Us!

Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12th December 2006, 10:10 PM
Valent Offline
Registered User
 
Join Date: May 2004
Age: 34
Posts: 325
NAT problem, two external IPs - how ?

I have wireless router, with one external and one internal network interface.
external interface - ra0 - 10.31.6.31
internal interface - eth0 - 10.31.31.1

clients in internal network use IP's 10.31.31.2-40 with default gateway 10.31.31.1

I have NAT setup with:
iptables -t nat -A POSTROUTING -s 10.31.31.0/24 -o ra0 -j MASQUERADE

is it possible to make one new client (10.31.31.39) have a different external IP (10.31.6.41) ?

I tried adding virtual interface:
ifconfig ra0:1 10.31.6.41 netmask 255.255.255.0

and adding more NAT rules:
iptables -t nat -A PREROUTING -d 10.31.6.41 -j DNAT --to-destination=10.31.31.39
iptables -t nat -A POSTROUTING -s 10.31.31.39 -j SNAT --to-source=10.31.6.41

but that doesn't work, it seams that first NAT rule overwrites all other.

So how can I setup TWO independent external IP adresses in my internal network?

I would like this:
10.31.31.1-10 to have external IP of 10.31.6.31 and
10.31.31.39 to have external IP of 10.31.6.41

Thank you in advance.
Reply With Quote
  #2  
Old 13th December 2006, 01:38 AM
Brian1's Avatar
Brian1 Offline
Registered User
 
Join Date: Nov 2004
Location: Seymour, Indiana
Posts: 2,511
Pulled this from http://www.linuxhomenetworking.com/w...Using_iptables
Code:
# PREROUTING statements for 1:1 NAT
# (Connections originating from the Internet)

iptables -t nat -A PREROUTING -d 97.158.253.26 -i eth0 \
        -j DNAT --to-destination 192.168.1.100

# POSTROUTING statements for 1:1 NAT
# (Connections originating from the home network servers)

iptables -t nat -A POSTROUTING -s 192.168.1.100 -o eth0 \
         -j SNAT --to-source 97.158.253.26
Read the sections on post routing 1 to 1 and many to 1. Since using AliasIP for the addtional IP leave out the -o eth0 in the example. Iptables does not handle Alias IP structure like eth0:0. For that use use the IP and all is fine there.

Brian
Brian
__________________
Distribution: RHEL 5.1 with Pieces of this and that.
Kernel 2.6.23.9, KDE 3.5.8 and KDE 4.0 beta, Plus Development src.rpm, ATI fglrx64_7_1_0-8.433-1 rpm with 3D and DRI working.
Acer 5100-5840 with webcam, ati, sdcard reader, sound, atheros based wireless, all working. Only thing not working is the memory stick reader.
Reply With Quote
  #3  
Old 14th December 2006, 09:28 PM
mediator's Avatar
mediator Offline
Registered User
 
Join Date: Dec 2006
Location: I am ubuiquitous
Posts: 133
for having 2 ips u first need 2 NICs.
Reply With Quote
  #4  
Old 14th December 2006, 10:40 PM
Brian1's Avatar
Brian1 Offline
Registered User
 
Join Date: Nov 2004
Location: Seymour, Indiana
Posts: 2,511
You can have multiple IPs on the same nic. It is called IP Aliasing.
Don't know why I did not include this link but might help you out. http://www.faqs.org/docs/Linux-mini/IP-Alias.html

Brian
__________________
Distribution: RHEL 5.1 with Pieces of this and that.
Kernel 2.6.23.9, KDE 3.5.8 and KDE 4.0 beta, Plus Development src.rpm, ATI fglrx64_7_1_0-8.433-1 rpm with 3D and DRI working.
Acer 5100-5840 with webcam, ati, sdcard reader, sound, atheros based wireless, all working. Only thing not working is the memory stick reader.
Reply With Quote
  #5  
Old 15th December 2006, 05:48 AM
mediator's Avatar
mediator Offline
Registered User
 
Join Date: Dec 2006
Location: I am ubuiquitous
Posts: 133
Yea, but IP-aliasing is for same network i.e like 10.10.10.xx , but for 2 different networks u need to have 2 NICs. But in @Valent's case IP-aliasing is possible.
Reply With Quote
Reply

Tags
external, ips, nat, problem

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
External HD Problem, F11 silvercard Hardware & Laptops 5 13th October 2009 08:53 PM
external hdd problem ronan.l.n Hardware & Laptops 8 5th August 2008 05:18 PM
FC9 External HD problem smashingoftheva Hardware & Laptops 0 21st June 2008 04:37 PM
Problem with External HDD RedhaT_BoY69 Using Fedora 1 4th March 2008 08:30 PM


Current GMT-time: 22:50 (Saturday, 25-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat