Page 1 of 1

Multiple Ip's

Posted: 2012/10/17 16:47:08
by Thirupathi
Hi All,

I have configured multiple ips in my centos box when i run the ifconfig or ifconfig -a command ifcfg-eth0:0 is not showing. Please help me.

Regards
Thiru

Re: Multiple Ip's

Posted: 2012/10/17 17:28:51
by TrevorH
Try running `ip addr show` and see if it's listed that way

Multiple Ip's

Posted: 2012/10/19 10:42:10
by jlehtone
[quote]Thirupathi wrote:
I have configured multiple ips ...[/quote]
By which method?

Note: If I use service 'network' and have a /etc/sysconfig/network-scripts/ifcfg-eth0:
[code]BOOTPROTO=static
IPADDR=a.b.c.d
NETMASK=255.255.255.0
IPADDR0=e.f.g.h
NETMASK0=255.255.255.0[/code]
Then "ip addr show" lists both addresses, but "ifconfig" shows only the a.b.c.d.

Re: Multiple Ip's

Posted: 2012/10/24 20:45:47
by Skaperen
[quote]
jlehtone wrote:
[quote]Thirupathi wrote:
I have configured multiple ips ...[/quote]
By which method?

Note: If I use service 'network' and have a /etc/sysconfig/network-scripts/ifcfg-eth0:
[code]BOOTPROTO=static
IPADDR=a.b.c.d
NETMASK=255.255.255.0
IPADDR0=e.f.g.h
NETMASK0=255.255.255.0[/code]
Then "ip addr show" lists both addresses, but "ifconfig" shows only the a.b.c.d.[/quote]
Commands "ifconfig" and "ip addr show" use different kernel features to add additional IP addresses. The "ifconfig" command expects interface alias with one IP per alias (e.g. "eth1" and "eth1:0" and "eth1:1" ... actually just about anything can be used for the alias). The "ip" command uses newer kernel facilities to just add an IP to an existing interface (shows multiple IPs, including IPv6 where appropriate).

Re: Multiple Ip's

Posted: 2014/05/12 16:34:55
by metacyclic
Sorry to resurrect, but I was brought by the Googles.

I ran into the exact same issue. And without any errors thrown from CentOS, I couldn't figure out why this was happening. This is what my conf files looked like at first:

Code: Select all

# cd /etc/sysconfig/network-scripts/
# diff ifcfg-eth0 ifcfg-eth0:0
8c8
< IPADDR=172.18.5.50
---
> IPADDR=172.18.5.61
Can you spot the problem? It looked fine to me, and no errors were being thrown. Turns out, the diff should look like this:

Code: Select all

# diff ifcfg-eth0 ifcfg-eth0:0
1c1
< DEVICE=eth0
---
> DEVICE=eth0:0
8c8
< IPADDR=172.18.5.50
---
> IPADDR=172.18.5.61
The device name change is what was missing for me. Now ifconfig returns what I expect it to. :)