Delete User Default profile
Due to the default emptying, the configuration file is the system automatically generated user device profile saved under/etc/udev/rule.d/:
# Cp/etc/udev/rule.d/etc/udev/rule.d.bak.0-r
# rm/etc/udev/rule.d/*
Modify the NIC configuration file to add multiple IP configurations
#vim/etc/network/interfaces
Modify or add the following:
Auto Lo iface lo inet loopback auto eth0 iface eth0 inet static address192.168.76.192netmask255.255.255.0Gateway192.168.76.254Auto eth0:0iface eth0:0inet Static Address192.168.76.193netmask255.255.255.0Gateway192.168.76.254Auto eth0:1iface eth0:1inet Static Address192.168.76.194netmask255.255.255.0Gateway192.168.76.254
Lab environment, I have added three IP addresses
Let the configuration take effect
#/etc/init.d/networking restart
Check effect
#ifconfig
eth0 Link encap:ethernet HWaddr-------------------------------
inet addr:192.168.76.192 Bcast : 192.168.76.255 mask:255.255.255.0
Inet6 addr:fe80::92e6:baff:fea0:b517/ Scope:link
up broadcast RUNNING multicast mtu:1500 metric:1
Span style= "color: #800080;" > RX packets:17278 errors:0 dropped:0 overruns:0 frame:0
TX packets:7044 errors:0 dropped:0 overruns:0 carrier:1
collisions:0 txqueuelen:1000
RX bytes:8162087 (8.1 MB) TX bytes:1085377 (1.0 MB)
interrupt:30
eth0:0 Link encap:ethernet HWaddr-------------------------------
inet addr:192.168.76.193 bcast:192.168.76.255 mask:255.255.255.0
Up broadcast RUNNING multicast mtu:1500 metric:1
Interrupt:30
Eth0:1 Link encap:ethernet HWaddr-------------------------------
inet addr:192.168.76.194 bcast:192.168.76.255 mask:255.255.255.0
Up broadcast RUNNING multicast mtu:1500 metric:1
Interrupt:30
You can see three IP addresses, which indicates that the configuration was successful.
Configuration of multiple IP addresses for Ubuntu under single NIC