From owner-freebsd-net@FreeBSD.ORG Mon Mar 8 07:50:40 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F24BB16A4CE for ; Mon, 8 Mar 2004 07:50:39 -0800 (PST) Received: from ints.mail.pike.ru (ints.mail.pike.ru [195.9.45.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 17A4A43D1F for ; Mon, 8 Mar 2004 07:50:39 -0800 (PST) (envelope-from babolo@cicuta.babolo.ru) Received: (qmail 68668 invoked from network); 8 Mar 2004 16:08:02 -0000 Received: from babolo.ru (HELO cicuta.babolo.ru) (194.58.226.160) by ints.mail.pike.ru with SMTP; 8 Mar 2004 16:08:02 -0000 Received: (nullmailer pid 38095 invoked by uid 136); Mon, 08 Mar 2004 15:51:37 -0000 X-ELM-OSV: (Our standard violations) hdr-charset=KOI8-R; no-hdr-encoding=1 In-Reply-To: <20040308091935.59513.qmail@web41811.mail.yahoo.com> To: Jerry Jensen Date: Mon, 8 Mar 2004 18:51:37 +0300 (MSK) From: "."@babolo.ru X-Mailer: ELM [version 2.4ME+ PL99b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: <1078761097.455893.38094.nullmailer@cicuta.babolo.ru> cc: freebsd-net@freebsd.org Subject: Re: multiple logical interfaces X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2004 15:50:40 -0000 > How can this be done programmatically rather than from > the command line? Code snippets would be handy. What "this" is? ifconfig? execlp("ifconfig", "ifconfig", "lo0", "inet", inetxt); I never ifconfigured from C. Sorry. > --- .@babolo.ru wrote: > > > Actually, what I want is the equivalent of this (which > > > is in Linux) on FreeBSD. Note the ip address > > > associated with each of the logical interfaces > > > (lo:XX). > > And what? > > 0cicuta~(11)#ifconfig lo0 > > lo0: flags=8049 mtu 16384 > > inet6 ::1 prefixlen 128 > > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x7 > > inet 127.0.0.1 netmask 0xffffff00 > > 0cicuta~(12)#ifconfig lo1 > > lo1: flags=8049 mtu 16384 > > inet 127.0.1.1 netmask 0xffffff00 > > inet 127.0.1.2 netmask 0xffffffff > > 0cicuta~(13)#ifconfig lo2 > > lo2: flags=8008 mtu 16384 > > 0cicuta~(14)#ifconfig lo3 > > lo3: flags=8008 mtu 16384 > > 0cicuta~(15)#ifconfig lo3 192.168.0.1/24 > > 0cicuta~(16)#ifconfig lo3 > > lo3: flags=8049 mtu 16384 > > inet 192.168.0.1 netmask 0xffffff00 > > > > The only disadvantage in > > 0cicuta~(17)#uname -a > > FreeBSD cicuta.babolo.ru 4.9-RC FreeBSD 4.9-RC #0: Fri Oct 10 11:37:45 MSD 2003 babolo@cicuta.babolo.ru:/tmp/babolo/usr/src/sys/cicuta i386 > > is that lo can't be created dynamically. > > > > One more quection: why not alias the lo0 ? > > > > > eth0 Link encap:Ethernet HWaddr > > > 00:06:5B:19:55:EE > > > inet addr:10.2.1.122 Bcast:10.255.255.255 Mask:255.0.0.0 > > > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > > > RX packets:5903525 errors:0 dropped:0 overruns:0 frame:0 > > > TX packets:5337692 errors:0 dropped:0 overruns:0 carrier:0 > > > collisions:0 txqueuelen:1000 > > > Interrupt:16 Base address:0xecc0 Memory:fe2ff000-fe2ff038 > > > > > > eth1 Link encap:Ethernet HWaddr 00:06:5B:19:55:EF > > > inet addr:192.168.6.122 Bcast:192.168.6.255 Mask:255.255.255.0 > > > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > > > RX packets:1818518022 errors:2 dropped:0 overruns:263 frame:2 > > > TX packets:1182175968 errors:0 dropped:0 overruns:0 carrier:0 > > > collisions:0 txqueuelen:1000 > > > Interrupt:17 Base address:0xec80 Memory:fe2fe000-fe2fe038 > > > > > > lo Link encap:Local Loopback > > > inet addr:127.0.0.1 Mask:255.0.0.0 > > > UP LOOPBACK RUNNING MTU:16436 Metric:1 > > > RX packets:199 errors:0 dropped:0 overruns:0 frame:0 > > > TX packets:199 errors:0 dropped:0 overruns:0 carrier:0 > > > collisions:0 txqueuelen:0 > > > > > > lo:10 Link encap:Local Loopback > > > inet addr:202.175.33.10 Mask:255.255.255.255 > > > UP LOOPBACK RUNNING MTU:16436 Metric:1 > > > > > > lo:11 Link encap:Local Loopback > > > inet addr:193.65.100.99 Mask:255.255.255.255 > > > UP LOOPBACK RUNNING MTU:16436 Metric:1 > > > > > > lo:12 Link encap:Local Loopback > > > inet addr:193.65.100.100 Mask:255.255.255.255 > > > UP LOOPBACK RUNNING MTU:16436 Metric:1 > > > > > > lo:13 Link encap:Local Loopback > > > inet addr:210.183.28.42 Mask:255.255.255.255 > > > UP LOOPBACK RUNNING MTU:16436 Metric:1 > > > > > > --- .@babolo.ru wrote: > > > > > is it possible in freebsd to have multiple logical > > > > > interfaces associated with say the loopback interface? > > > > > if so, how does one do this programmatically (as > > > > > opposed to from the command line). > > > > > > > > > > need this for building traffic generators that need to > > > > > simulate a bunch of different ip sources. solaris > > > > > allows it as does linux i believe. > > > > > thx. > > > > Is it what you want? > > > > > > > > > ifconfig -a | grep lo > > > > lo0: flags=8049 mtu 16384 > > > > inet6 fe80::1%lo0 prefixlen 64 scopeid 0xa > > > > lo1: flags=8049 mtu 16384 > > > > lo2: flags=8008 mtu 16384 > > > > lo3: flags=8008 mtu 16384 > > > > > > > > If it is, there is from kernel config: > > > > > > > > > grep loop /sys/i386/conf/garkin > > > > pseudo-device loop 4 # Network loopback