Adding multiple static IPs to one network card?

Asked by sherwin

i'm running ubuntu 10.04 server 64bit. i need to add some static ips. i edited the /etc/networking/interfaces so it looks like this

iface eth0 inet static
address xxx.x.xxx.31
netmask 255.255.255.0
network xxx.x.xxx.0
broadcast xxx.x.xxx.255
gateway xxx.x.xxx.75

iface eth0:1 inet static
address xxx.x.xxx.43
netmask 255.255.255.0
network xxx.x.xxx.0
broadcast xxx.x.xxx.255
gateway xxx.x.xxx.75

then i restarted the service /etc/init.d/networking restart

i can ping it from the server but i can't ping it from another machine on the same network? i checked ufw and it's disabled. is there any other firewall configs i missed? is it a firewall issue? the first static ip works. i can ping it locally and on other machines. there are 2 websites hosted on the 1st ip. now i need to host other websites with their own ip.

please help.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gnome-nettool Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
Last query:
Last reply:
Revision history for this message
Best actionparsnip (andrew-woodhead666) said :
#1

The addresses are class C so are intrnal and behind a router, masking the network address doesn't really do much.

You cannot give the eth0 an address, you will need to create another subinterface for any IPs you want to give so the file will be:

iface eth0:0 inet static
address xxx.x.xxx.31
netmask 255.255.255.0
network xxx.x.xxx.0
broadcast xxx.x.xxx.255
gateway xxx.x.xxx.75

iface eth0:1 inet static
address xxx.x.xxx.43
netmask 255.255.255.0
network xxx.x.xxx.0
broadcast xxx.x.xxx.255
gateway xxx.x.xxx.75

And it will work, if you give the raw interface an address then the virtual devices won't work

Revision history for this message
sherwin (sherwinm-deactivatedaccount) said :
#2

Thanks actionparsnip, that solved my question.