home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
comm
/
amitcp-3.0ß2.lha
/
AmiTCP
/
src
/
util
/
ifconfig
/
ifconfig.c
next >
Wrap
C/C++ Source or Header
|
1994-02-24
|
25KB
|
881 lines
static char rcsid[] =
"$Id: ifconfig.c,v 3.1 1994/02/22 03:28:22 ppessi Exp $";
/*
* ifconfig.c --- Configure Network Interfaces
*
* Author: Pekka Pessi <Pekka.Pessi@hut.fi>
*
* Copyright © 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
* Helsinki University of Technology, Finland.
* All rights reserved.
*
* Created : Sat May 15 04:12:15 1993 ppessi
* Last modified: Tue Feb 22 01:35:17 1994 ppessi
*/
#include "ifconfig_rev.h"
static const char version[] = VERSTAG " "
"Copyright © 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>\n"
"Helsinki University of Technology, Finland.\n"
"All rights reserved.\n"
"@(#) Copyright © 1983 The Regents of the University of California.\n"
"All rights reserved.\n";
/****** netutil.doc/ifconfig ************************************************
NAME
ifconfig - configure network interface parameters
VERSION
$Id: ifconfig.c,v 3.1 1994/02/22 03:28:22 ppessi Exp $
SYNOPSIS
ifconfig interface address_family [address [dest_address]] [params]
ifconfig interface [address_family]
DESCRIPTION
ifconfig is used to assign an address to a network interface and/or
configure network interface parameters. ifconfig must be used at
boot time to define the network address of each interface present on
a machine. It can also be used at other times to redefine an
interface's address or other operating parameters.
PARAMETERS
interface A string of the interface name concatenated with unit
numver, for example `eth0'. The AmiTCP/IP network
interfaces are defined in the `AmiTCP:db/interface'
file. For example, a interface sl corresponds by
default to `Devs:networks/rhcslip.device'.
address_family
Name of protocol on which naming scheme is based. An
interface can receive transmissions in differing
protocols, each of which may require separate naming
schemes. Therefore, it is necessary to specify the
address_family, which may affect interpretation of the
remaining parameters on the command line. The only
address family currently supported is inet (DARPA-
Internet family).
address Either a host name present in the host name database,
(SEE hosts), or a DARPA Internet address
expressed in Internet standard "dot notation". The
host number can be omitted on 10-Mbyte/second Ethernet
interfaces (which use the hardware physical address),
and on interfaces other than the first.
dest_address Address of destination system. Consists of either a
host name present in the host name database, hosts(4),
or a DARPA Internet address expressed in Internet
standard "dot notation".
SWITCHES
The following operating parameters can be specified:
up Mark an interface "up". Enables interface after an
"ifconfig down." Occurs automatically when setting the
address on an interface. Setting this flag has no
effect if the hardware is "down".
down Mark an interface "down". When an interface is marked
"down", the system will not attempt to transmit
messages through that interface. If possible, the
interface will be reset to disable reception as well.
This action does not automatically disable routes
using the interface.
arp Enable the use of Address Resolution Protocol in
mapping between network level addresses and link-level
addresses (default).
-arp Disable the use of Address Resolution Protocol.
metric n Set the routing metric of the interface to n, default
0. The routing metric is used by the routing protocol
(see gated). Higher metrics have the effect of making
a route less favorable; metrics are counted as
additional hops to the destination network or host.
debug Enable driver-dependent debugging code. This usually
turns on extra console error logging.
-debug Disable driver-dependent debugging code.
netmask mask (Inet only) Specify how much of the address to reserve
for subdividing networks into sub-networks. mask
includes the network part of the local address, and
the subnet part which is taken from the host field of
the address. mask can be specified as a single hexa-
decimal number with a leading 0x, with a dot-notation
Internet address, or with a pseudo-network name listed
in the file AmiTCP:db/networks. `mask' contains 1's
for each bit position in the 32-bit address that are
to be used for the network and subnet parts, and 0's
for the host part. mask should contain at least the
standard network portion, and the subnet field should
be contiguous with the network portion.
broadcast (Inet only) Specify the address that represents
broadcasts to the network. The default broadcast
address is the address with a host part of all 1's.
The command:
ifconfig interface/unit
with no optional command arguments supplied displays the current
configuration for interface. If address_family is specified,
ifconfig reports only the details specific to that address family.
DIAGNOSTICS
Messages indicating that the specified interface does not exist, the
requested address is unknown, or the user is not privileged and
tried to alter an interface's configuration.
EXAMPLES
ifconfig lo0 127.0.0.1
This command marks internal loopback device "UP", and
attach an inet address 127.0.0.1 to it.
ifconfig cslip0 inet 193.102.4.144 193.102.4.129
This command starts the CSLIP driver, attach an
address 193.102.4.144 (our internet address) and a
destination address 193.102.4.129 (the internet
address of the host you are connecting) to it.
ifconfig eth0 inet 193.124.100.64 netmask 255.255.255.192 -arp
This command loads an ethernet driver (by default for the
Commodore A2065 Ethernet adapter unit 0), marks it "up",
disables ARP protocol for it, attaches an inet address
193.124.100.65 to it and sets its netmask to
255.255.255.192. A bitwise logical and of netmask and
address for the interface forms a subnet address, in this
case 193.124.100.64. All packets aimed to hosts with same
subnet address (that is hosts 193.124.100.64 -
193.124.100.127) are routed to this interface.
FILES
AmiTCP:db/interfaces
SEE ALSO
netstat, hosts, arp, "net/if.h", "net/sana2tags.h"
*****************************************************************************
*
*/
/*
* Copyright © 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of c