xref: /OK3568_Linux_fs/kernel/Documentation/networking/alias.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun===========
4*4882a593SmuzhiyunIP-Aliasing
5*4882a593Smuzhiyun===========
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunIP-aliases are an obsolete way to manage multiple IP-addresses/masks
8*4882a593Smuzhiyunper interface. Newer tools such as iproute2 support multiple
9*4882a593Smuzhiyunaddress/prefixes per interface, but aliases are still supported
10*4882a593Smuzhiyunfor backwards compatibility.
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunAn alias is formed by adding a colon and a string when running ifconfig.
13*4882a593SmuzhiyunThis string is usually numeric, but this is not a must.
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunAlias creation
17*4882a593Smuzhiyun==============
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunAlias creation is done by 'magic' interface naming: eg. to create a
20*4882a593Smuzhiyun200.1.1.1 alias for eth0 ...
21*4882a593Smuzhiyun::
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun  # ifconfig eth0:0 200.1.1.1  etc,etc....
24*4882a593Smuzhiyun	~~ -> request alias #0 creation (if not yet exists) for eth0
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunThe corresponding route is also set up by this command.  Please note:
27*4882a593SmuzhiyunThe route always points to the base interface.
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunAlias deletion
31*4882a593Smuzhiyun==============
32*4882a593Smuzhiyun
33*4882a593SmuzhiyunThe alias is removed by shutting the alias down::
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun  # ifconfig eth0:0 down
36*4882a593Smuzhiyun	~~~~~~~~~~ -> will delete alias
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunAlias (re-)configuring
40*4882a593Smuzhiyun======================
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunAliases are not real devices, but programs should be able to configure
43*4882a593Smuzhiyunand refer to them as usual (ifconfig, route, etc).
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunRelationship with main device
47*4882a593Smuzhiyun=============================
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunIf the base device is shut down the added aliases will be deleted too.
50