Article by Khaled
1. Setup More than one IP address for one network interface:
The file which contains descriptions of the network interfaces on Ubuntu or debian is /etc/nework/interfaces
A network interface (material) by default is referenced by eth0 so if you have more than one it would be eth1 eth2,
etc… so to setup a virtual ip we should create a virtual network interface, the name of this one would be as follows
eth0:1, eth0:2 etc… to create this interface we should add some lines to the
/etc/network/interfaces file to discribe this interface
NB: modifying this file need the superuser privilages
laptop:/$ sudo nano /etc/network/interfaces
We add this lines
auto eth0:1 //——————-we have one eth0 and we add another virtual interface refered by :1
iface eth0:1 inet static //——-this interface would use a static IP We can use dhcp as well
address 192.168.1.34 //——— IP we want to assign
netmask 255.255.255.0 //——— The netmask IP
broadcast 192.168.1.255 //——– Broadcast IP
gateway 192.168.1.1 //——– Gateway (router or…)
Save the file
As you can see this is a simple text file, so right now the network interface isn’t set yet because this
configuration isn’t applied
To set it we should restart our network interface by using this command with superuser privilages:
laptop:/$ sudo /etc/init.d/networking restart
Your interface is set
To verify if it works you can ping the address you assigned by useing this command
laptop:/$ ping [IP_you_assigned]
_______________________________________________________________________________________
2. There is a second method we can use is not permanent which means if you restart your machine or your interface
it would be deleted.
To do it we have to use the binary file /sbin/ip
To add a virtual IP we use this command:
laptop:/$ sudo /sbin/ip addr add [IP_you_want_to_add]/24 dev eth0
Here we don’t need to restart our network interface cause it’s not a simple file it a binary file it’s applied by
this command.
To check that your change works you can ping the new address using this command:
laptop:/$ sudo ping [IP_address_you_added]
You can also verify the new IP has been added by using the ifconfig command as shown below:
laptop:/$ ifconfig eth0:1
eth0:1 Link encap:Ethernet HWaddr 00:26:b9:11:34:16
inet addr:192.168.3.22 Bcast:192.168.3.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
Interrupt:19 Base address:0xa000
This will show you that the address you assigned is actually on the correct interface.
1 Response to Adding IP Addresses to Ubuntu -via Khaled
NC
August 29th, 2010 at 9:15 pm
2001 http://vgreinercgwr.ALLSTOCKSPORT.INFO/tag/Christian+League+of+NC+2001+recliner/ : of…
of…