LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-17-2002, 06:46 PM   #1
gofauna
LQ Newbie
 
Registered: Jul 2002
Posts: 6

Rep: Reputation: 0
Using Linux as Router for 2 IPs


Hi everyone, this is my brief situation:

I'm currently running Mandrake 8.2 and I'm a total newb. I got IP Masquerade working for one of my connection. However, since my ADSL can automatically assign 2 IP addresses (2 WAN IPs), I was wondering if I can tell my Linux box to grab those 2 IPs (it's okay if I need extra NICs). What I want is to have my windows clients (5 of them actually) to simultaneously share these 2 IPs accordingly. That means, I want to have Linux to use (or try to use) a different IP for different computers. For example, if only 2 windows clients are on, they will each use a different IP to do the routing. That way, I will be able to play games such as StarCraft (I know it's old school, but whatever = ) with each other. Will this require the Windows clients to use DHCP to grab IPs from the Linux server, such as 192.168.1.X, where if X is odd, it uses WAN IP #1 and if X is even it uses WAN IP #2?

Also, is it possible to have conenctions from the outside world be automatically forwarded into a Windows client? Starcraft uses port 6112 (hence, now I can join games but cannot have others join me behind the Linux routing) that way I can create games or servers on my client computers. I know that I still cannot have all 5 clients creating a game at the same time, but I was wondering if the windows clients could run a telnet executable telling the Linux server to route the port 6112 from WAN IP #1 to that specific windows client? And vice versa if it uses WaN IP #2??

Whew, hopefully you guys can understand what I want. I have difficulty explaining it = )
 
Old 07-17-2002, 09:39 PM   #2
sarin
Member
 
Registered: May 2001
Location: India, Kerala, Thrissur
Distribution: FC 7-10
Posts: 354
Blog Entries: 2

Rep: Reputation: 34
Well, You can grab two ips and do all that you said here.
But I don't know the exact steps. "iptables" is the stuff
that you should go for. ( It is a firewall which I think
should be a part of Mandrake. -- It is there in latest
kernel. ). Here is a good guide on that.

http://people.unix-fu.org/andreasson...-tutorial.html

--Sarin
PS: To grab 2 ips you may not need this. Just make 2 interfaces
and keep the bootproto as dhcp. I think that should work.
 
Old 07-17-2002, 10:14 PM   #3
turnip
Member
 
Registered: Jul 2002
Posts: 143

Rep: Reputation: 15
The easiest way to do this w/o a dhcp server is this

in linux you already have one ip assigned to ppp0 i assume. so do this

ifconfig ppp0:1 <otherip> up

route add -host <publicip> dev ppp0:1

now ppp0 has 2 addresses only one is on ppp0:1 so then you do

iptables -t nat -A PREROUTING -p tcp -d <otherip> --dport 1:65000 -j DNAT --to internalip

iptables -t nat -A PREROUTING -p udp -d <otherip> --dport 1:65000 -j DNAT --to internalip

where internal ip is the private assigned to your machine. that should forward all traffic to the other public ip to a private inside the lan
so then we just need masq rules.

iptables -t nat -A POSTROUTING -s <localip> -d <publicip> -j MASQUERADE

then iptables -A OUTPUT -s <publicip> -j ACCEPT

this might need some editing here, its been awhile since ive had to do this, but it's possible. you're going to have to play with default routes on the windows machine as well.

and like i said setting up a dhcp scope for the one ip would work too.

Last edited by turnip; 07-17-2002 at 10:29 PM.
 
Old 07-17-2002, 10:38 PM   #4
turnip
Member
 
Registered: Jul 2002
Posts: 143

Rep: Reputation: 15
the masquerade rule is wrong, clearly. Im working on it though.
 
Old 07-18-2002, 01:26 AM   #5
gofauna
LQ Newbie
 
Registered: Jul 2002
Posts: 6

Original Poster
Rep: Reputation: 0
how would I go about creating a eth1 or eth2 based on the same ethernet card? I want to have LAN IPs for eth1. Currently it is set up to be eth0:0 alias.
 
Old 07-18-2002, 01:33 AM   #6
sarin
Member
 
Registered: May 2001
Location: India, Kerala, Thrissur
Distribution: FC 7-10
Posts: 354
Blog Entries: 2

Rep: Reputation: 34
I don't think you can create eth1, eth2 etc on the same
card. You can anyway have eth0:0, eth0:1 etc.
( Even if it does, if you are looking for a good firewall/
gateway, it won't be a good idea.)
--Sarin.
 
  


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
Using static ips with a router jclu Linux - Hardware 2 07-31-2005 05:35 PM
linux as3 working as router with 2 public IPs rajeshdogra Linux - Networking 1 07-18-2005 07:53 AM
Linux as a router but for multiple public IPs gnirtS Linux - Networking 8 03-07-2005 03:08 PM
A couple of IPs and the router... DHR Linux - Networking 4 09-12-2004 05:59 AM
Public IPs behind router Buzer Linux - Networking 2 09-20-2003 01:36 PM

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

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