Skip to content

Instantly share code, notes, and snippets.

@luksi1
Created February 8, 2019 15:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luksi1/e3b67b2f7e984217be86e2e933035216 to your computer and use it in GitHub Desktop.
Save luksi1/e3b67b2f7e984217be86e2e933035216 to your computer and use it in GitHub Desktop.
Add Virtual IP address to a loopback interface in Ubuntu and CentOS/Redhat
# /etc/sysconfig/ifcfg-lo
DEVICE=lo
# localhost
IPADDR0=127.0.0.1
NETMASK0=255.0.0.0
NETWORK0=127.0.0.0
BROADCAST0=127.255.255.255
# virtual ip
IPADDR1=<VIRTUAL IP ADDRESS>
NETMASK1=255.255.255.255
ONBOOT=yes
NAME=loopback
# /etc/networks/interaces
auto lo
iface lo inet loopback
up ip addr add dev lo <VIRTUAL IP ADDRESS>/32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment