Multiple Ip's

Issues related to configuring your network
Post Reply
Thirupathi
Posts: 2
Joined: 2012/10/07 10:57:06

Multiple Ip's

Post by Thirupathi » 2012/10/17 16:47:08

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

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Multiple Ip's

Post by TrevorH » 2012/10/17 17:28:51

Try running `ip addr show` and see if it's listed that way

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Multiple Ip's

Post by jlehtone » 2012/10/19 10:42:10

[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.

Skaperen
Posts: 6
Joined: 2012/10/24 18:36:26

Re: Multiple Ip's

Post by Skaperen » 2012/10/24 20:45:47

[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).

metacyclic
Posts: 1
Joined: 2014/05/12 16:25:33

Re: Multiple Ip's

Post by metacyclic » 2014/05/12 16:34:55

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. :)

Post Reply