[CentOS] Multiple IP Address

Sat Sep 15 16:54:08 UTC 2007
Les Mikesell <lesmikesell at gmail.com>

Brett Serkez wrote:
>>>> I have only assumed it is the address that matches it's
>>> host name, which
>>>> is why I always configure that in the /etc/hosts file.
>>> Right, one would think so, but this doesn't seem to effect
>>> this behavior either.
>>>
>>> Shutting down and start up OpenVPN immediately effects the behavior,
>>> indicating this behavior is dynamic.   I've been searching for a way
>>> to effect this behavior, perhaps in a configuration file
>>> (/etc/sysconfig... or /proc/...) with no luck so far.
>> I should have asked this, but what do you mean by the default IP on
>> a multi-homed host?
> 
> It is not multi-homed, as described in my initial post.  It has only
> one ethernet card with a single IP address.  The problem comes in when
> running OpenVPN which adds two virtual adapters, each with a unique IP
> address (i.e., 10.55.5.x and 10.55.6.x).

There should be no difference in IP behavior that would relate to the 
interface being an ethx or tunx device.

> When OpenVPN is stopped, all works fine, it is only with OpenVPN
> running that the server starts using one of the IPs from the last
> virtual adapter as its IP address, in some cases.

I thought what is supposed to happen for outbound connections is that 
unless an application specifically binds a socket to an address, it 
should pick the interface on the subnet of the next-hop router toward 
the destination address.  This can still be confusing if you have 
multiple alias addresses on the same subnet, though.

>> I am unsure whether there is a default IP at all and the routing table
>> decides which interface depending on the source and destination IP
>> addresses used on the host.
> 
> OpenVPN does modify the routing table, but only for the specific
> subnet routing, ie. 10.55.5.0/24 and 10.55.6.0/24.
> 
> The problem is that when a Windows desktop is OpenVPN connected to
> another CentOS system on the same local network as the subject server
> on an unrelated subnet ( i.e. 10.55.3.0/24) it is given the subject
> server's 10.55.6.x address vs. the ethernet 10.44.0.x address, which
> would work perfectly.
> 
> So from a Windows workstation on the local subnet, if I ping
> CentOServer I get 10.44.0.x, which is what I want.  If I am on the
> Windows desktop VPN connected to the other CentOS server on subnet
> 10.55.3.0/24 and I ping CentOSServer I get 10.55.6.x vs the 10.44.0.x
> I would have expected. 

Are you talking about IP addressing or windows name resolution here? If 
you are pinging by name, windows can use dns or netbios to resolve the 
name to an IP.  Then the centos side will just respond from the same IP. 
  Is the name in DNS?

> There should be no relationship between the
> originating Workstation's IP and the IP it is given for CentOServer,
> but there is, I am trying to understand why if there is a way to
> change this behavior.

I have no idea how windows netbios relates to multihomed hosts - or even 
what samba's nmbd announces.  You should be able to test from the 
windows box with nslookup to check dns and nbtstat for netbios.

-- 
   Les Mikesell
    lesmikesell at gmail.com