Ubuntu Linux: Creating ethernet alias for eth0 network device
Q. I am using Ubuntu Linux and I would like to know how to create alias for eth0 so that I can have multiple IP address?
A. To create alias for eth0 use ifconfig command. It is use to configure a network interface and aliases.
Assuming that your eth0 IP is 192.168.1.10 and you would like to create an alias eth0:0 with IP 192.168.1.11. Type the following command:
sudo ifconfig eth0:0 192.168.1.11 up
OR
sudo /sbin/ifconfig eth0:0 192.168.1.11 up
Verify that alias is up and running using following two command(s):
/sbin/ifconfig
ping 192.168.1.11
ping your-getway-ip
Permanent configuration
Your ethernet configuration is located in a file called /etc/network/interfaces. If you reboot system you will lost your alias. To make it permanent you need to add it network configuration file:
gksudo gedit /etc/network/interfaces
OR
sudo vi /etc/network/interfaces
Append the following configuration:
auto eth0:0
iface eth0:0 inet static
name Ethernet alias LAN card
address 192.168.1.11
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
Save the file and restart system or restart the network:
sudo /etc/init.d/networking restart
Please note that you can also use graphical tools located at System > Administration > Networking menu. Or use the following GUI tool to setup aliases, hostname, dns settings etc:
sudo network-admin
If you want more network aliases, use eth0:1, eth0:2, eth0:N (max upto 254).
See also:
Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
You may also be interested in other helpful articles:
- Linux Force or restart network card auto-negotiation with ethtool
- How Do I run firewall script as soon as eth0 interface brings up?
- floppy0: no floppy controllers found – HP / IBM / Dell Server error and solution
- Howto: Configure Linux Virtual Local Area Network (VLAN)
- What Can You Do With A Second Linux Server Ethernet port?
Discussion on This Article:
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: /etc/network/interfaces, aliases, card address, configuration file, dns settings, etc network, ethernet configuration, getway, graphical tools, ifconfig eth0, lan card, network admin, network configuration, network interface, network interfaces, system administration, ubuntu ip alias, ubuntu ip aliasing, Ubuntu Linux



/sbin/infconfig
There’s no such command. Fix the typo
kotnik,
Err…
thanks for heads up
Thank you so much for this guide! It is easy to understand.
simple and good guide. Thank you.
What if you don’t use a permanent ip address and
rely on DHCP to assign the IP address?
Is this correct?
sudo ifconfig eth0 up
Do I need to setup dhcp?
what does mean this line:
name Ethernet alias LAN card
i look into man interfaces, but can’t found about name syntax
thx
i solve my problem of multi addresses.