How to add multiple ip addresses online in Linux
Last Update:2017-08-26
Source: Internet
Author: User
How to add multiple ip addresses online in a Linux system-Linux Enterprise Application-Linux server application information. To add multiple ip addresses online in Linux, you must first view the ip addresses.
Linuxedu.net # ifconfig
Eth0 Link encap: Ethernet HWaddr 00: 50: BA: EF: 21: E2
Inet addr: 192.168.1.1 Bcast: 192.168.1.255 mask: 255.255.255.0
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 3433865 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 2730922 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 100
RX bytes: 2610363482 (2489.4 Mb) TX bytes: 577832769 (551.0 Mb)
Interrupt: 11 Base address: 0xc000
Lo Link encap: Local Loopback
Inet addr: 127.0.0.1 Mask: 255.0.0.0
Up loopback running mtu: 16436 Metric: 1
RX packets: 811139 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 811139 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 2007636558 (1914.6 Mb) TX bytes: 2007636558 (1914.6 Mb)
Add ip
Ifconfig eth0: 0 192.168.1.2 netmask 255.255.255.255 up
In view.
Linuxedu.net # ifconfig
Eth0 Link encap: Ethernet HWaddr 00: 50: BA: EF: 21: E2
Inet addr: 192.168.1.1 Bcast: 192.168.1.255 Mask: 255.255.255.0
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 3433865 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 2730922 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 100
RX bytes: 2610363482 (2489.4 Mb) TX bytes: 577832769 (551.0 Mb)
Interrupt: 11 Base address: 0xc000
Eth0: 0 Link encap: Ethernet HWaddr 00: 50: BA: EF: 21: E2
Inet addr: 192.168.1.2 Bcast: 192.168.1.255 Mask: 255.255.255.255
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 3433471 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 2730637 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 100
RX bytes: 2610321034 (2489.3 Mb) TX bytes: 577696691 (550.9 Mb)
Interrupt: 11 Base address: 0xc000
Lo Link encap: Local Loopback
Inet addr: 127.0.0.1 Mask: 255.0.0.0
Up loopback running mtu: 16436 Metric: 1
RX packets: 811139 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 811139 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 2007636558 (1914.6 Mb) TX bytes: 2007636558 (1914.6 Mb)
Finally, it is written to the file to take effect upon restart.
Vi/etc/sysconfig/network-scripts/ifcfg-eth0: 0
DEVICE = eth0: 0
ONBOOT = yes
BOOTPROTO = static
IPADDR = 192.168.1.2
Remove ip
Ifconfig eth0: 0 192.168.1.2 netmask 255.255.255.255 down
Rm/etc/sysconfig/network-scripts/ifcfg-eth0: 0
Complete