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 01-10-2010, 11:13 AM   #1
adam7979
LQ Newbie
 
Registered: Jan 2010
Posts: 10

Rep: Reputation: 0
how to utilize multiple ext. ip


hi guys,

i have 3 external IPs, assigned on eth0, eth0:1 and eth0:2.

I have a game bot that connects to a game network, but the game network only accepts a limit of 5 connection from same ip. The game network has multiple IP addresses. (e.g. game.com resolves to 1.1.1.1, 1.1.1.2, 1.1.1.3 etc)

How do i specify that certain bot connects via eth0:1 and eth0:2? Currently all bots are using eth0's ip.

Thanks for any input.

Regards,
Adam
 
Old 01-10-2010, 01:54 PM   #2
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
Is there a place on the client's side that allows you to change the host? If so simply change the host parameter to one of the other IPs. That should do the trick.

Regards,

Alunduil
 
Old 01-10-2010, 05:23 PM   #3
adam7979
LQ Newbie
 
Registered: Jan 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks alunduil ... Tried it, didn't work The initial connecting process is still using eth0 i guess....

I'm thinking of something like "if connect to 1.1.1.1 to 1.1.1.3 use eth0, if connect to 1.1.1.4 to 1.1.1.6 use eth0:1" etc. Is that possible with iptables?

Adam
 
Old 01-10-2010, 05:28 PM   #4
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
Should be, but it should be handled automatically by the interfaces' routing table. What's the output of netstat -nrt?

Regards,

Alunduil
 
Old 01-10-2010, 06:45 PM   #5
adam7979
LQ Newbie
 
Registered: Jan 2010
Posts: 10

Original Poster
Rep: Reputation: 0
thanks again,
Code:
[root@mymachine ~]# netstat -nrt
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
ext.ip.160.0     0.0.0.0         255.255.240.0   U         0 0          0 eth0
169.254.0.0      0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         ext.ip.160.1     0.0.0.0         UG        0 0          0 eth0
[root@mymachine ~]# ifconfig
eth0      inet addr:ext.ip.161.xxx  Bcast:ext.ip.175.255  Mask:255.255.240.0
eth0:0    inet addr:ext.ip.167.yyy  Bcast:ext.ip.175.255  Mask:255.255.240.0
eth0:1    inet addr:ext.ip.168.zzz  Bcast:ext.ip.175.255  Mask:255.255.240.0

Last edited by adam7979; 01-10-2010 at 06:47 PM.
 
Old 01-10-2010, 06:53 PM   #6
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
Originally Posted by adam7979 View Post
hi guys,
...
The game network has multiple IP addresses. (e.g. game.com resolves to 1.1.1.1, 1.1.1.2, 1.1.1.3 etc)
...
Adam
What is exact IP of the game server? I would like to know last digits (xxx.xxx.___.___)

Thanks
 
Old 01-10-2010, 06:56 PM   #7
adam7979
LQ Newbie
 
Registered: Jan 2010
Posts: 10

Original Poster
Rep: Reputation: 0
it's useast.battle.net
 
Old 01-10-2010, 06:59 PM   #8
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
The first problem I see is that you have one interface being used for all outgoing traffic. You need one entry for each interfaces IP and subnet in the routing table unless, are you trying to get a round robin style load balance to happen?

Regards,

Alunduil
 
Old 01-10-2010, 07:02 PM   #9
adam7979
LQ Newbie
 
Registered: Jan 2010
Posts: 10

Original Poster
Rep: Reputation: 0
yeah right after you asked me to -nrt i saw my own problem... guess i'll take sometime to google it out. Thanks for the lead Alunduil

edit: tried the route add -host ext.ip dev eth0:0 from http://www.faqs.org/docs/Linux-mini/IP-Alias.html

am i still missing something ?

will google into round-robin style now, if that's possible....

Last edited by adam7979; 01-10-2010 at 07:41 PM.
 
Old 01-10-2010, 07:39 PM   #10
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
I have not ask you, is your game bot on linux ?
 
Old 01-10-2010, 07:45 PM   #11
adam7979
LQ Newbie
 
Registered: Jan 2010
Posts: 10

Original Poster
Rep: Reputation: 0
yeah, i compile and run ghost bot (www.codelain.com) on linux, and it comes to a point that i need to get the 9th bot to connect to the same realm (useast.battle.net) with my second external IP address. Limit per realm IP is 8. Hope i made it clear.
 
Old 01-10-2010, 08:09 PM   #12
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
You can try like this:
Add to iptable rule:
Code:
iptables -t nat -A POSTROUTING -p ALL -j SNAT --to-source 192.168.1.1-192.168.1.5
Change that IP range to real one.
 
Old 01-10-2010, 08:30 PM   #13
adam7979
LQ Newbie
 
Registered: Jan 2010
Posts: 10

Original Poster
Rep: Reputation: 0
thanks for the input, nimnull. A quick google on your suggestion returns me this before i actually try it on my own server. Will try it later (because my ip address(es) is not continuous...) and let you know the result while i'll keep googling further

Last edited by adam7979; 01-10-2010 at 08:32 PM.
 
Old 01-10-2010, 08:53 PM   #14
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
In that case, you can also read about "balance":
http://linux.die.net/man/1/balance
 
Old 01-11-2010, 12:45 AM   #15
adam7979
LQ Newbie
 
Registered: Jan 2010
Posts: 10

Original Poster
Rep: Reputation: 0
thanks again nimnull and alunduil, i did it the most stupid way but, it's working
Code:
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.1 --to-source my.ext.ip.1
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.2  --to-source my.ext.ip.1
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.3  --to-source my.ext.ip.1
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.4  --to-source my.ext.ip.1
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.5  --to-source my.ext.ip.2
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.6  --to-source my.ext.ip.2
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.7  --to-source my.ext.ip.2
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.8  --to-source my.ext.ip.2
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.9  --to-source my.ext.ip.3
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.10  --to-source my.ext.ip.3
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.11  --to-source my.ext.ip.3
iptables -t nat -A POSTROUTING -p ALL -j SNAT --dst game.server.ip.12  --to-source my.ext.ip.3
 
  


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
Utilize passphrase created smallbook Linux - Security 9 01-28-2008 03:05 AM
Multi Processor - How to utilize it efficiently? bence8810 Linux - General 6 10-15-2006 03:12 PM
utilize 4gb of ram cynick Linux - General 2 04-20-2006 11:42 AM
Filesystems: ext 2, ext 3, reiserfs. Which one? r3dhatter Linux - Newbie 12 07-15-2004 12:53 AM
Need to Utilize Full Potential md2bn08 Linux - Newbie 4 06-28-2004 11:31 AM

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

All times are GMT -5. The time now is 02:45 PM.

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