Linux create a sub-interface card

Create a sub-interface card, add IP aliases

ifconfig eth0:0  2.2.2.2/24

or

ip addr add 2.2.2.2/24 dev eth0 label eth0:0

 

Clear sub-interface card, remove the IP alias

ifconfig eth0:1 down

or

ip addr del 2.2.2.2/24 dev eth0 label eth0:0

 

After successful configuration, ifconfig View:

 

If you want the configuration permanent, create / etc / sysconfig / network-scripts / ifcfg-eth0: 0, added:

DEVICE=eth0:0
IPADDR=2.2.2.2
PREFIX=24
ONPARENT=yes

The system is restarted sub-interface still exists 

Guess you like

Origin www.cnblogs.com/reachos/p/12167744.html