In Ubuntu, I configure virtual IP addresses to achieve high availability. Next, let's take a look at how to set virtual IP addresses in Ubuntu12.04. First, let's take a look at my Ubuntu IP Address: www.2cto.com [plain] chenshu @ sloop2 :~ $ Ifconfig eth0 Link encap: Ethernet HWaddr d0: 67: e5: ef: 5a: 6e inet addr: describcast: 10.112.18.255 Mask: 255.255.255.0 inet6 addr: fe80: d267: e5ff: feef: 5a6e/64 Scope: Link up broadcast running multicast mtu: 1500 Metric: 1 RX packets: 341661 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 242801 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 1000 RX bytes: 328287656 (328.2 MB) TX Bytes: 31858367 (31.8 MB) Interrupt: 17 lo Link encap: Local Loopback inet addr: 127.0.0.1 Mask: 255.0.0.0 inet6 addr: 1/128 Scope: Host up loopback running mtu: 16436 Metric: 1 RX packets: 17904 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 17904 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 0 RX bytes: 2160236 (2.1 MB) TX bytes: 2160236 (2.1 MB) ping 191. If you find that the network does not exist, use it as a virtual IP address. After sudo-s, run the following command: www.2cto.com [plain] ifconfig eth0: 0 10.112.18.191 netmask 255.255.255.0 up to ensure that the virtual IP address and the local IP address are in the same network segment. Let's take a look at whether it is successful: [plain] ifconfig eth0 Link encap: Ethernet HWaddr d0: 67: e5: ef: 5a: 6e inet addr: 10.112.18.158 Bcast: Illegal Mask: Illegal 255.255.0 inet6 addr: fe80: d267: e5ff: feef: 5a6e/64 Scope: Link up broadcast running multicast mtu: 1500 Metric: 1 RX packets: 347634 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 246488 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 1000 RX bytes: 3357971 45 (335.7 MB) TX bytes: 32178089 (32.1 MB) Interrupt: 17 eth0: 0 Link encap: Ethernet HWaddr d0: 67: e5: ef: 5a: 6e inet addr: invalid Bcast: Invalid Mask: 255.255.255.0 up broadcast running multicast mtu: 1500 Metric: 1 Interrupt: 17 lo Link encap: Local Loopback inet addr: 127.0.0.1 Mask: 255.0.0.0 inet6 addr ::: 1/128 Scope: Host up loopback running mtu: 16436 Metric: 1 RX packets: 17953 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 17953 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 0 RX bytes: 2164072 (2.1 MB) TX bytes: 2164072 (2.1 MB) Local test: www.2cto.com [plain] ping 10.112.18.191 PING 10.112.18.191 (10.112.18.191) 56 (84) bytes of data. 64 bytes from 10.112.18.191: icmp_req = 1 ttl = 64 time = 0.028 MS replacement machine test: [plain] edward @ edward-catamaran :~ $ Ping 10.112.18.191 PING 10.112.18.191 (10.112.18.191) 56 (84) bytes of data. 64 bytes from 10.112.18.191: icmp_req = 1 ttl = 64 time = 0.916 MS 64 bytes from 10.112.18.191: icmp_req = 2 ttl = 64 time = 0.258 MS the method for deleting a virtual IP address. What should I do after ifconfig eth0: 0 down? Of course, the configuration is saved to ensure that the virtual IP address is still there after restart. Directly add [plain] zookeeper without auto lo iface lo inet loopback www.2cto.com auto eth0: 0 iface eth0: in the/etc/network/interfaces file: 0 inet static name Ethernet alias LAN card address 10.112.18.191 netmask 255.255.255.0 broadcast 10.112.18.255 network 10.112.18.0 restart the network service. /Etc/init. d/networking restart