Configuring IP address aliasing

2004-01-26 Thread Mike
Greetings,

I have 2 Redhat-9 servers that I'd like to migrate to FreeBSD in the 
next 3 months.  So I've set-up a test server (FreeBSD-4.9 STABLE) and 
I'm in the midst of loading 3rd party applications (via ports) to test 
their operation compared to the RH-9 servers.

I have a question about the configuration of IP aliases, so here is some 
background information.

Here is the real interface (192.168.1.40):

# ifconfig -a
ed0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
inet 192.168.1.40 netmask 0xff00 broadcast 192.168.1.255
ether 00:80:ad:91:9a:bd
lp0: flags=8810POINTOPOINT,SIMPLEX,MULTICAST mtu 1500
ppp0: flags=8010POINTOPOINT,MULTICAST mtu 1500
sl0: flags=c010POINTOPOINT,LINK2,MULTICAST mtu 552
faith0: flags=8002BROADCAST,MULTICAST mtu 1500
lo0: flags=8049UP,LOOPBACK,RUNNING,MULTICAST mtu 16384
inet 127.0.0.1 netmask 0xff00
Now I try to add the alias (192.168.1.41):

# ifconfig ed0 alias 192.168.1.41 netmask 255.255.255.0 broadcast 
192.168.1.255
ifconfig: ioctl (SIOCAIFADDR): File exists
[using same netmask as real interface]

However, THIS WORKED:
# ifconfig ed0 alias 192.168.1.41 netmask 255.255.255.255 broadcast 
192.168.1.255
[using a netmask of 255.255.255.255]

And here is the ifconfig that shows the alias in place:

# ifconfig -a
ed0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
inet 192.168.1.40 netmask 0xff00 broadcast 192.168.1.255
inet 192.168.1.41 netmask 0x broadcast 192.168.1.255
ether 00:80:ad:91:9a:bd
lp0: flags=8810POINTOPOINT,SIMPLEX,MULTICAST mtu 1500
ppp0: flags=8010POINTOPOINT,MULTICAST mtu 1500
sl0: flags=c010POINTOPOINT,LINK2,MULTICAST mtu 552
faith0: flags=8002BROADCAST,MULTICAST mtu 1500
lo0: flags=8049UP,LOOPBACK,RUNNING,MULTICAST mtu 16384
inet 127.0.0.1 netmask 0xff00
QUESTION: Why do I use a different netmask (255.255.255.255) for a IP 
alias on FreeBSD?  Why isn't 255.255.255.0 used?

When I set-up IP aliases using Linux, I use the same netmask 
(255.255.255.0) as the real IP.

The IP aliasing of my BSD server works but WHY is it working?

I found the reference to using the 255.255.255.255 netmask via Google, 
however, I have Michael Lucas's book Absolute BSD and reference on 
pages 103  104 (on IP aliasing) clearly show using the same netmask as 
the real interface when creating IP aliases.

What am I missing?

Thanks,
Michael


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Configuring IP address aliasing

2004-01-26 Thread Alex Zbyslaw
Mike wrote:
# ifconfig -a
ed0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
inet 192.168.1.40 netmask 0xff00 broadcast 192.168.1.255

# ifconfig ed0 alias 192.168.1.41 netmask 255.255.255.0 broadcast 
192.168.1.255
ifconfig: ioctl (SIOCAIFADDR): File exists
[using same netmask as real interface]

However, THIS WORKED:
# ifconfig ed0 alias 192.168.1.41 netmask 255.255.255.255 broadcast 
192.168.1.255
[using a netmask of 255.255.255.255]

QUESTION: Why do I use a different netmask (255.255.255.255) for a IP 
alias on FreeBSD?  Why isn't 255.255.255.0 used?
From the ifconfig man page on 4.9

alias   Establish an additional network address for this interface.  This
is sometimes useful when changing network numbers, and one wishes
to accept packets addressed to the old interface.  If the address
is on the same subnet as the first network address for this
interface, a non-conflicting netmask must be given.  Usually
0x is most appropriate.
Since 192.168.1.41 is on the same subnet as 92.168.1.40 you must use 
0x (aka 255.255.255.255) as the netmask.  (I don't know *why* I'm afraid).

You could always stick the alias on a different subnet at which point you can 
use the netmask you expect.

e.g. # ifconfig ed0 alias 192.168.2.40 netmask 255.255.255.0 broadcast 
192.168.2.255

--Alex

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Configuring IP address aliasing

2004-01-26 Thread jan . muenther
Hello,

 I found the reference to using the 255.255.255.255 netmask via Google, 
 however, I have Michael Lucas's book Absolute BSD and reference on 
 pages 103  104 (on IP aliasing) clearly show using the same netmask as 
 the real interface when creating IP aliases.

This book is blatantly wrong then. Basically, the point is that the network
route already exists and the network extension is already clear. So, you
must use a non-conflicting netmask. 

The ifconfig manpage describes this as well, by the way. 

Cheers, J.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Configuring IP address aliasing

2004-01-26 Thread Matthew Seaman
On Mon, Jan 26, 2004 at 08:40:18AM -0800, Mike wrote:
 QUESTION: Why do I use a different netmask (255.255.255.255) for a IP 
 alias on FreeBSD?  Why isn't 255.255.255.0 used?

It's all about routing of outgoing packets.  Unlike linux, you can't
use the route(8) command to set up a route to a directly attached
network.  All of the local routing is controlled through ifconfig(8)
-- when you run:

# ifconfig fxp0 inet 192.168.0.1 netmask 0xff00 broadcast 192.168.0.255 up

amongst other things, that establishes that interface as the route to
the 192.168.0.0/24 network.  It also says that the source address on
packets sent out of that interface will be 192.168.0.1

Now suppose you add an alias address on the same subnet:

# ifconfig fxp0 add 192.168.0.2 netmask 0x broadcast 192.168.0.255

Since the netmask is a /32 it says this interface is the route to the
specific single address.  It also means that the 192.168.0.2 address
is only used on outgoing packets from connections directly to the
alias address.  That's a bit of a simplification, as one of the
principle uses for alias addresses is to support jail(8)ed processes,
but it holds in general.

Could FreeBSD use exactly the same semantics as Linux or Solaris --
yes, sure.  But the FreeBSD way gives you a tad more control, and to
be honest, it's the way it is mostly because the people who wrote the
code thought that was the way it should be.  

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   26 The Paddocks
  Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614  Bucks., SL7 1TH UK


pgp0.pgp
Description: PGP signature


Re: Configuring IP address aliasing

2004-01-26 Thread Mike
Matthew Seaman wrote:

On Mon, Jan 26, 2004 at 08:40:18AM -0800, Mike wrote:

QUESTION: Why do I use a different netmask (255.255.255.255) for a IP 
alias on FreeBSD?  Why isn't 255.255.255.0 used?


It's all about routing of outgoing packets.  Unlike linux, you can't
use the route(8) command to set up a route to a directly attached
network.  All of the local routing is controlled through ifconfig(8)
-- when you run:
# ifconfig fxp0 inet 192.168.0.1 netmask 0xff00 broadcast 192.168.0.255 up

amongst other things, that establishes that interface as the route to
the 192.168.0.0/24 network.  It also says that the source address on
packets sent out of that interface will be 192.168.0.1
Now suppose you add an alias address on the same subnet:

# ifconfig fxp0 add 192.168.0.2 netmask 0x broadcast 192.168.0.255

Since the netmask is a /32 it says this interface is the route to the
specific single address.  It also means that the 192.168.0.2 address
is only used on outgoing packets from connections directly to the
alias address.  That's a bit of a simplification, as one of the
principle uses for alias addresses is to support jail(8)ed processes,
but it holds in general.
Could FreeBSD use exactly the same semantics as Linux or Solaris --
yes, sure.  But the FreeBSD way gives you a tad more control, and to
be honest, it's the way it is mostly because the people who wrote the
code thought that was the way it should be.  
Ah yes! What a great explanation.  Thanks Matthew.

Best Regards,
Michael
	Cheers,

	Matthew



___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]