Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Aug 1996 02:20:10 -0400 (EDT)
From:      Mark Mayo <mark@quickweb.com>
To:        freebsd-hackers@freebsd.org
Subject:   ifconfig alias with subnet..
Message-ID:  <Pine.BSF.3.94.960812020613.727A-100000@scooter.quickweb.com>

next in thread | raw e-mail | index | archive | help

Hi all, I seem to be having some problems with aliasing 'extra' IP numbers
to a single interface (ep0).

I think I'm correct in assuming that once I have the first address added
to the machine (the non alias - ifconfig ep0 inet 199.212.134.8 netmask
255.255.255.0) that when I add other addresses, the rule is this:

If the address is on the same Class C I alis with netmask of 0xffffffff.
But if alias with a netmask of 0xffffff00 if it's on a different Class C.

My questions is what happens when you are on a net that is subnetted? In
my case, I bring the interface up with :

root# ifconfig ep0 inet 199.212.134.8 netmask 255.255.255.240

Since the netmask is 240, I want to add the following two subnets: 

199.212.134.80
206.248.60.80

For the 199.212.134.80 'group of 16' I just did this:

root# ifconfig ep0 alias 199.212.134.81 .. 82 .. 83 .. etc.

And I got the file exists error, but things still seems to work. I was
concerned, but heh: if it works don't touch it,, no?  --> YES

Cause now when I tried to add to add the 206.248.60.80 sub, it didn't
work. So I tried doing this:

root# ifconfig ep0 alias 206.248.60.81 netmask 0xfffffff0

And voila, the .240 netmask worked, I got the .81 number up == but that's
all!!! I can only add the first number from this subnet successfully, the
rest just won't work - they go on with a file exists error, and the ping
gives me ret -1, host is down.

So all in all, I'm confused, and I guess I just want to know how to
correctly go about aliasing IPs on a subnetted network.

I can send along the results of my netstat -in and netstat -rn directly to
anyone who thinks thinks they can figure this out.. The results do seem
rather odd, which also makes be ask, how do you know which interface
link#2 is?? I assumed it was the second available interface, which seems
odd cause I've only got one card! But I've convinced myself that link#1
MUST be the loopback.. is this correct or do I have something
fundamentally wrong inside this machines config??


Thanks for any help, hopfully I have a little hair left by the time I
figure this one out  ;-)

-Mark

-------------------------------------------
| Mark Mayo		mark@quickweb.com |
| C-Soft  	        www.quickweb.com  |
-------------------------------------------
"To iterate is human, to recurse divine."
		- L. Peter Deutsch




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.94.960812020613.727A-100000>