ifup
ifstatus - show the state of a (preconfigured) net inter
face.
SYNOPSIS
if{up,down,status} config [ interface ] [-o options ]
NOTATION
We use the terms configuration, interface and device in a
dedicated way. A device is always the piece of hardware
representing a network interface, the PCI- or PCMCIA-card
or an USB device. An interface then is the name of the
network interface it gets from the kernel when the device
has been registered. A configuration is a set of parame
ters which can be assigned to an interface like ip
addresses or routes.
It is intentional that a configuration does not need to
belong to an interface, but to a device. For builtin
devices there is most of the time a fixed relation between
devices and interfaces, but this is no longer the case
when using hotpluggable devices. With such devices (like
PCMCIA or USB) you cannot always know which interface name
you will get.
DESCRIPTION
ifup is used to bring up a preconfigured interface for
networking. It is usually invoked by the network script at
boot time or by the PCMCIA/hotplug system. It can also be
used to start interfaces manually on the command line. It
activates the link, adds addresses and other parameters
and sets up the routes for an interface.
config is the name of a configuration that should be set
up. In most cases the configuration is named like the
interface to be used. In this case the argument interface
may be omitted. But there are cases where the interface
name is not known at configuration time. For example with
hotpluggable devices the interface name depends on the
order the devices are plugged in. For this purpose config
may be a description of the hardware that provides an
interface. In this case the interface name must be pro
vided as second argument.
Every configuration is stored in files below /etc/syscon
fig/network which are named ifcfg-hw-description. The
name of the configuration is hw-description. If you are
just using fixed devices then hw-description is just the
interface name. But if you have hotpluggable devices you
may want to describe the hardware for a configuration more
precisely. hw-description (or config) has the following
syntax:
{$interfacename,[$type-]$bustype[-$bus[-$id]],$mac}[:$alias]
address. Then it uses the configuration that fits best by
dropping first $id, then $bus and last $type and/or adding
$type.
Examples: we have the following configuration files:
ifcfg-eth0
ifcfg-eth-usb
ifcfg-pcmcia-1
the table shows what configuration will be used with these
ifup calls:
ifup eth0 ifcfg-eth0
ifup usb-0-5 eth1 ifcfg-eth-usb
ifup eth-pcmcia-1 eth1 ifcfg-pcmcia-1
ifup eth-pcmcia-0 eth1 ---
ifup eth-pcmcia-0 eth0 ifcfg-eth0
The name of the finally used configuration is stored
internally in the variable $CONFIG. You may use this
variable when using hooked scripts. See section variables
below.
OPTIONS
The following are options to be specified after the -o
switch.
[on]boot
Only set up the interface if the configuration has
the STARTMODE=onboot.
hotplug
Only set up the interface if the configuration has
the STARTMODE=hotplug.
doalias
Setup all aliases of a real interface.
quiet Suppress normal output.
debug Be verbose.
rc Special option for the use in rcnet
work (/etc/init.d/network). See section rcnetwork
below.
FILES
/sbin/ifup
The script itself.
/etc/sysconfig/network/ifcfg-*
The files containing the configuration of the
devices. An example that shows a typical configu
ration with the name ifcfg-eth0:
by the variables GLOBAL_POST_UP_EXEC and
GLOBAL_PRE_DOWN_EXEC in the network configuration
file /etc/sysconfig/network/config These are not
interface specific, and can have any name. If you
need interface/configfile specific scripts to be
executed have a look at PRE_UP_SCRIPT,
POST_UP_SCRIPT, PRE_DOWN_SCRIPT and
POST_DOWN_SCRIPT.
/etc/sysconfig/network/ifcfg.template
A template for writing ifcfg- files.
VARIABLES
The following is a list of variables that can be put in
the configuration file, with an example in parentheses.
STARTMODE (onboot|manual|hotplug)
Choose when the configuration should be activated.
At boot time, manually by the sysadmin or by the
PCMCIA/hotplug system.
BOOTPROTO (static|dhcp|bootp|6to4)
Setup protocol. If missing or "static", a fixed
address is used. Note that bootp is currently not
supported. (If you need it you will have to write a
script ifup-bootp and place it in /etc/syscon
fig/network/scripts. And we would of course like
to know at <feedback@suse.de>)
Use 6to4 to set up IPv6 tunnel interfaces running
in the "6to4" mode. See also the section Tunnel
interfaces below.
IPADDR (10.20.1.29)
IPADDR (3ffe:ffff:1::dead:beef/64)
IP address, either IPv4 or IPv6. If you need more
then one IP address see section Multiple addresses
below
NETMASK (255.255.240.0)
Network mask
BROADCAST (10.20.15.255)
Network broadcast. If you omit the broadcast
address, it will be calculated from netmask or pre
fixlength. You can affect the calculation with the
variable DEFAULT_BROADCAST in /etc/sysconfig/net
work/config. See the description there.
REMOTE_IPADDR (192.168.42.242)
The remote IP address of a point to point connec
for them in /etc/sysconfig/network/scripts but you
may use absolute paths as well.
You may use the internal variable $CONFIG in the
filename. Note that $CONFIG does contain the con
figuration that really is used by ifup and not what
you (or any system script) gave as the first argu
ment to ifup. See the section about config file
matching above.
These scripts will be called with the same argu
ments as any other helper script. This is almost
the arguments with which ifup was called, only the
first argument is again the configuration that
really is used by ifup and not what you (or any
system script) gave as the first argument to ifup.
See again the section about config file matching
above.
GENERAL VARIABLES
There are some general settings in the file /etc/syscon
fig/network/config. If needed you can also set every gen
eral variable as an individual variable in the ifcfg-*
files.
DEFAULT_BROADCAST
CHECK_FOR_MASTER
CHECK_DUPLICATE_IP
DEBUG
MODIFY_RESOLV_CONF_DYNAMICALLY
MODIFY_NAMED_CONF_DYNAMICALLY
CONNECTION_SHOW_WHEN_IFSTATUS
CONNECTION_CHECK_BEFORE_IFDOWN
CONNECTION_CLOSE_BEFORE_IFDOWN
CONNECTION_UMOUNT_NFS_BEFORE_IFDOWN
CONNECTION_SEND_KILL_SIGNAL
Please see the description of these variables in
/etc/sysconfig/network/config.
Multiple addresses (aka aliases)
addresses, then just add the same extension to
these variable names.
IPADDR_AAA=1.2.3.4
NETMASK_AAA=255.0.0.0
BROADCAST_AAA=1.2.3.55
IPADDR_BBB=10.10.2.3/16
LABEL_BBB=BBB
and so on ...
You do not need to set a label for any address. But then
you should not use ifconfig any longer; go and use ip. If
you want to use ifconfig then omit the label for your main
address and set a label for every additional address.
This is equivalent with using aliases with method 1.
Tunnel interfaces
It is possible to create tunnel interfaces for three dif
ferent protocols: SIT (IPv6 over IPv4 tunnel), GRE (uni
versal IPv4 tunnel) and IPIP (IPv4 over IPv4 tunnel).
Since there is not yet a YaST2 support for creating tun
nels one must write appropriate config files by hand for
now.
These new variables are to be used in tunnel config files:
TUNNEL Here you have to set the tunnel protocol. This may
be "sit" for IPv6 over IPv4 tunnel, "gre" for uni
versal IPv4 tunnel and "ipip" for IPv4 over IPv4
tunnel.
TUNNEL_LOCAL_IPADDR or TUNNEL_LOCAL_INTERFACE
The address of the local tunnel's end could be
directly specified in TUNNEL_LOCAL_IPADDR variable.
If TUNNEL_LOCAL_IPADDR is empty the first ipv4
address from the interface given in the variable
TUNNEL_LOCAL_INTERFACE will be used.
TUNNEL_REMOTE_IPADDR
TUNNEL_TTL
Specify the Time To Life of the packet which car
ries the tunneled data. Usually it is set to 64 but
in some circumstances you may want do use something
else between 1 and 255. Special value is "inherit"
in which case the TTL is copied from the inner
(tunneled) packet. This is also the default if the
TTL variable wasn't used.
TUNNEL_OPTIONS
Here you may set additional options for the command
ip tunnel add
STARTMODE='onboot'
BOOTPROTO='static'
TUNNEL='gre'
TUNNEL_LOCAL_IPADDR='192.168.1.2'
TUNNEL_REMOTE_IPADDR='172.16.2.3'
IPADDR='10.20.30.40'
TUNNEL_TTL='64'
IPIP tunnel is created in exactly the same way,
except that the variable TUNNEL has to be set to
"ipip" in this case. Use filename ifcfg-ipip0 in
this case.
SIT tunnels for IPv6 over IPv4
There are two modes in which SIT tunnels may oper
ate: static and 6to4
To create a "static" tunnel one needs to know an
IPv4 address of the remote end, while for a "6to4"
tunnel the remote end is a "6to4 relay". These
relays are usually public and could be reached
either under their respective IPv4 address or under
a unique IPv4 anycast address 192.88.99.1 (as
defined in RFC 3068).
This typical config file for a 6to4 tunnel should
fit most user's needs and the only required change
is the external interface name. Default filename:
ifcfg-sit1
STARTMODE='onboot'
BOOTPROTO='6to4'
TUNNEL='sit'
TUNNEL_LOCAL_INTERFACE='eth0'
TUNNEL_TTL='64'
Additionally you need to set some routes. Do that
in a file called ifroute-<configname> with the same
configname as in ifcfg-<configname>. Default file
name: ifroute-sit1 It may look like this:
2000::/3 2002:c058:6301::1 - - - metric 1
The magic string 2002:c058:6301::1 is a 6to4 ver
sion of the anycast IPv4 address 192.88.99.1.
To create a "static" tunnel with local IPv6 address
3ffe:ffff::1234/64 use a config file like this:
Default filename: ifcfg-sit1
STARTMODE='onboot'
BOOTPROTO='static'
TUNNEL='sit'
TUNNEL_LOCAL_IPADDR='192.168.1.2'
TUNNEL_REMOTE_IPADDR='172.16.2.3'
IPADDR='3ffe:ffff::1234/64'
ration Profile Management (SCPM).
Another example: If you have two network intefaces and
configure one as onboot and the other as manual and you
never brought up the manual interface, then rcnetwork
restart will only stop and start the onboot interface. But
if you brought up the manual interface with ifup (that is
important), then a restart will stop and start both. If
the manual interface was brought up in another way (call
ing ip or ifconfig directly) it will just be shut down.
Some background information on this: For every configura
tion that is set up with ifup manually or by a hotplug
script, ifup stores the name of the used interface in run
time files /var/run/sysconfig/if-config and deletes this
info with ifdown. rcnetwork calls ifup with the option
rc. Therefore ifup does not store/delete this informa
tion, but looks if it finds such information for any
interface with STARTMODE other than onboot. ifup then may
set up a configuration without giving the interface name
as 2nd argument. E.g. if you already plugged your USB NIC
and did a rcnetwork stop you can just type ifup usb,
because the interface name was stored in /var/run/syscon
fig/if-usb.
DIAGNOSTICS
ifstatus interface
BUGS
Please report bugs at <feedback@suse.de>
AUTHOR
Christian Zoz <zoz@suse.de> -- ifup script
Michal Svec <msvec@suse.cz> -- ifup script
Bjoern Jacke -- ifup script
Mads Martin Joergensen <mmj@suse.de> -- ifup manpage
Michal Ludvig <mludvig@suse.cz> -- tunnel support
SEE ALSO
/etc/sysconfig/network/ifcfg.template, routes(5)
sysconfig January 2003 IFUP(8)
|