Setting up Second IP address or Virtual IP address in Ubuntu

If you are a server system administrator or normal user some time you need to assign a second ipaddress to your Ubuntu machine.For this you need to edit the /etc/network/interfaces file and you need to add the following syntax.Below one is the only example you need to chnage according to your ip address settings

sudo vi /etc/network/interfaces

auto eth0:1
iface eth0:1 inet static
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x

You need to enter all the details like address,netmask,network,broadcast and gateways values after entering all the values save this file and you need to restart networking services in debian using the following command to take effect of our new ipaddress.

After entering all the details you need to restart networking services using the following command

sudo /etc/init.d/networking restart

Force Postfix to bind to a set ip address

Add the following to your file (/etc/postfix/

smtp_bind_address =

to set tell smtp to bind to this IP (smtp_bind_address6 if using IPv6).
note that with this smtp will always use this IP (contrast with the
default when smtp binds to “any address” and it is the routing code that
selects the source IP based on the route (outgoing interface).