LinuxQuestions.org
Help answer threads with 0 replies.
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 11-25-2002, 06:15 PM   #1
drpixel
LQ Newbie
 
Registered: Nov 2002
Location: Kansas
Distribution: RedHat 7.2
Posts: 3

Rep: Reputation: 0
Exclamation multiple ips, multiple gateways, one interface


Greetings all!

I'm not much of a TCP/IP person so please forgive me if this is a simple answer, but I think I've tried everything I can think of. Here's the problem. I run a small co-located server that I currently host my friends on, as well as a few clients. I do IP based hosting, and have just run out of my initial allotment of IPs from my ISP.

The two blocks of IP's are on different subnets, and I'm having a tough time getting it configured. Here's an example of my IP blocks. (IP Addys withheld to protect the guilty!) I have included a lot of detail so that someone smarter than me can double check my math!

Block #1
-----------
network: xxx.xxx.177.64
gw: xxx.xxx.177.65
range: xxx.xxx.177.66 thru 78
netmask: 255.255.255.240

Block #2
-----------
network: xxx.xxx.144.48
gw: xxx.xxx.144.49
range: xxx.xxx.144.50 thru 61
netmask: 255.255.255.240

The server's primary IP address is xxx.xxx.177.66, and default gateway is xxx.xxx.177.65. All aliased IP addresses work on the first block, no problem. I attempted to add an IP alias on the second block by first using 'ifconfig' like so:
ifconfig eth0:1 netmask 255.255.255.240 broadcast xxx.xxx.144.62 xxx.xxx.144.51

then I attempted to add another default gateway, using:
route add default gw xxx.xxx.144.49 dev eth0:1

I can ping myself with no problem when logged into the box via SSH, but from remote, I get the dreaded 'Destination Unreachable' errors. I know I'm not doing this right, can someone please tell me what I'm not doing, or doing wrong, or at least which bridge to jump off of?

Thanks!
 
Old 11-26-2002, 02:35 PM   #2
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Rep: Reputation: 30
what is the output from:
route -n
 
Old 11-26-2002, 03:03 PM   #3
drpixel
LQ Newbie
 
Registered: Nov 2002
Location: Kansas
Distribution: RedHat 7.2
Posts: 3

Original Poster
Rep: Reputation: 0
Here's an interesting side note... I just rebooted the server, which of course cleared the ifconfig eth0:1 step mentioned earlier. When I attempted to add the alias interface back using the procedure listed above, I got:

Code:
[root@cp root]# ifconfig eth0:1 netmask 255.255.255.240 broadcast xxx.xxx.144.62 xxx.xxx.144.51
SIOCSIFNETMASK: Cannot assign requested address
SIOCSIFBRDADDR: Cannot assign requested address
SIOCSIFFLAGS: Cannot assign requested address
Now running ifconfig again shows that the interface is UP and RUNNING. is this abnormal?

Here's the output of the route -n command you requested.

Code:
[root@cp root]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
xxx.xxx.144.48  0.0.0.0         255.255.255.240 U     0      0        0 eth0
xxx.xxx.177.64  0.0.0.0         255.255.255.240 U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         xxx.xxx.144.49  0.0.0.0         UG    0      0        0 eth0
0.0.0.0         xxx.xxx.177.65  0.0.0.0         UG    0      0        0 eth0
[root@cp root]#
 
Old 12-03-2002, 08:48 AM   #4
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Rep: Reputation: 30
Sorry for the delay in responding (birth of a second child has really slowed me down). I'm not a routing guru. I had a similar (but different) problem trying to route do both a bridge and a router on a linux box. see
http://www.linuxquestions.org/questi...threadid=31882

I would guess that your problem is that your outgoing packets (the zeros in the two left column entries) have two possible addresses (144.49 and 177.65).

Quote:
0.0.0.0 xxx.xxx.144.49 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 xxx.xxx.177.65 0.0.0.0 UG 0 0 0 eth0
Its unclear to me how the packet would know which address to pick. I'm sorry but I don't know the solution to this but the moderator Peter Robb usually has the solution (i'll be happy to look at it the next time i'm on a linux box).
 
Old 12-03-2002, 03:15 PM   #5
drpixel
LQ Newbie
 
Registered: Nov 2002
Location: Kansas
Distribution: RedHat 7.2
Posts: 3

Original Poster
Rep: Reputation: 0
I appreciate the help! I too was wondering how it would magically know which gateway to use, other than to track which IP the packets came from, then reply through the appropriate gateway.

Seems like there has to be a way to do this somehow. I'd think a lot of ISPs and webhosting companies would run across this problem quite often as the expand their business. (although I'm sure careful planning would help eliminate this a lot!)
 
Old 12-03-2002, 03:58 PM   #6
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Rep: Reputation: 30
if i had to guess, i'd say that you need a bridge to do what you want to do and you haven't mentioned anything about that. all of the ip aliasing address how-to's I have seen, have used examples of ip addresses all on the same network:
see e.g.:
http://www.tldp.org/HOWTO/mini/IP-Alias/commands.html

for information on a bridge, try:
http://www.linux.org/docs/ldp/howto/BRIDGE-STP-HOWTO/


if you think I'm wrong, could you give the actual output of

/sbin/ifconfig -a (redact IP addresses if you like)
/proc/net/aliases
/proc/net/alias_types


Last edited by rioguia; 12-04-2002 at 12:02 AM.
 
Old 12-04-2002, 12:56 AM   #7
clavius
Member
 
Registered: Dec 2002
Location: Romania, Tg-Jiu City
Distribution: Slackware
Posts: 35

Rep: Reputation: 15
Quote:
Originally posted by rioguia

if you think I'm wrong, could you give the actual output of

/sbin/ifconfig -a (redact IP addresses if you like)
/proc/net/aliases
/proc/net/alias_types
/proc/net/aliases ? which kernel version ?

You cannot expect to have 2 default routes with 2 different gateways unless you are using dynamic routing and assign to them different metrics. That's because only one can be used at a moment time. And the default used is that which is first in the kernel routing table, unless you are using some metrics.

Be carefull... linux marks packets with eth0's ip source even the gateway is in the network of eth0:1 IP ;( This behavoir I've discovered recently...
 
  


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
multiple gateways efm Linux - Newbie 4 06-10-2005 08:50 AM
Multiple Gateways inforlinx Linux - Networking 1 02-22-2005 08:28 PM
Adding Multiple Ips to 1 Interface kemplej Slackware 1 12-27-2004 09:18 AM
Red Hat 7.3 and multiple gateways on multiple interfaces bluefmc Linux - Networking 2 11-19-2004 05:01 PM
how to define a specific range of IPs and/or multiple IPs in an iptables rule?... TheHellsMaster Linux - Security 9 09-20-2004 10:06 AM


All times are GMT -5. The time now is 10:57 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration