From owner-freebsd-hackers Mon Sep 21 04:28:56 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA20471 for freebsd-hackers-outgoing; Mon, 21 Sep 1998 04:28:56 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from relay.ucb.crimea.ua (relay.ucb.crimea.ua [194.93.177.113]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA20462 for ; Mon, 21 Sep 1998 04:28:20 -0700 (PDT) (envelope-from ru@ucb.crimea.ua) Received: (from ru@localhost) by relay.ucb.crimea.ua (8.8.8/8.8.8) id OAA05102; Mon, 21 Sep 1998 14:23:58 +0300 (EEST) (envelope-from ru) Date: Mon, 21 Sep 1998 14:23:57 +0300 From: Ruslan Ermilov To: Graham Wheeler , hackers@FreeBSD.ORG Subject: Re: ifconfig alias weirdness Message-ID: <19980921142357.A1023@relay.ucb.crimea.ua> Mail-Followup-To: Graham Wheeler , hackers@FreeBSD.ORG References: <199809210953.LAA04029@cdsec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.94.7i In-Reply-To: <199809210953.LAA04029@cdsec.com>; from Graham Wheeler on Mon, Sep 21, 1998 at 11:53:49AM +0200 X-Operating-System: FreeBSD 2.2.7-STABLE i386 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi! On Mon, Sep 21, 1998 at 11:53:49AM +0200, Graham Wheeler wrote: > Hi all > > On a different note to the hang/reboot, I've noticed the following which > may be a bug, or perhaps I'm just missing something (or maybe I'm just > being pedantic!). Yes, you are missing the FAQ article "How can I setup Ethernet aliases". > > If I want to set up an alias on an interface with a subnet, there are > two different behaviours I observe depending on whether or not the > netmask is specified with the alias. > > If I use: > > ifconfig ed0 inet 196.37.78.96 netmask 255.255.255.240 up > ifconfig ed0 inet 196.37.78.99 alias > > then the routes get messed up. After the first ifconfig the routes > are correct: > > 196.37.78.96/26 link#1 ^^ Are you sure it is equal 26? if you use 255.255.255.240, it should be 28. > > But after the alias we have: > > 196.37.78 link#1 > 196.37.78.96/26 link#1 > > which indicates that an implicit netmask of 255.255.255.0 has been used. Yes, you're absolutely right. This is a class C address, so the default netmask for it will be 255.255.255.0. Imagine, if you'd have 2 different class C networks hosted on your machine: ifconfig ed0 inet 192.168.1.1 netmask 255.255.255.0 ifconfig ed0 inet 192.168.2.1 netmask 255.255.255.0 alias > On the other hand, if I use: > > ifconfig ed0 inet 196.37.78.99 netmask 255.255.255.240 alias > > then the alias is right, and the bad route doesn't get added; however, > ifconfig prints an error: `SIOCIFADDR: file exists'. This is what your kernel should do, because when you issue ``ifconfig'' command, your kernel implicitly adjusts its routing table with "interface" route, which is marked as "link#N" in the ``netstat -r'' output. In your case, when you issue ifconfig ed0 inet 196.37.78.99 netmask 255.255.255.240 alias this "interface" route will be 196.37.78.96/28, and it's already exists. > > I can live with the error message, but it is a bit disturbing. > In your specific case, when you want an alias from an already defined subnet, you should specify netmask as 255.255.255.255: ifconfig ed0 inet 196.37.78.99 netmask 255.255.255.255 alias Best regards, -- Ruslan Ermilov Sysadmin and DBA of the ru@ucb.crimea.ua United Commercial Bank +380.652.247.647 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message