Multiple Ip's

Issues related to configuring your network

Multiple Ip's

Postby 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
Thirupathi
 
Posts: 2
Joined: 2012/10/07 10:57:06

Re: Multiple Ip's

Postby TrevorH » 2012/10/17 17:28:51

Try running `ip addr show` and see if it's listed that way
User avatar
TrevorH
Forum Moderator
 
Posts: 13329
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Multiple Ip's

Postby jlehtone » 2012/10/19 10:42:10

Thirupathi wrote:
I have configured multiple ips ...

By which method?

Note: If I use service 'network' and have a /etc/sysconfig/network-scripts/ifcfg-eth0:
Code: Select all
BOOTPROTO=static
IPADDR=a.b.c.d
NETMASK=255.255.255.0
IPADDR0=e.f.g.h
NETMASK0=255.255.255.0

Then "ip addr show" lists both addresses, but "ifconfig" shows only the a.b.c.d.
User avatar
jlehtone
 
Posts: 1485
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Multiple Ip's

Postby Skaperen » 2012/10/24 20:45:47

jlehtone wrote:
Thirupathi wrote:
I have configured multiple ips ...

By which method?

Note: If I use service 'network' and have a /etc/sysconfig/network-scripts/ifcfg-eth0:
Code: Select all
BOOTPROTO=static
IPADDR=a.b.c.d
NETMASK=255.255.255.0
IPADDR0=e.f.g.h
NETMASK0=255.255.255.0

Then "ip addr show" lists both addresses, but "ifconfig" shows only the a.b.c.d.

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).
Skaperen
 
Posts: 6
Joined: 2012/10/24 18:36:26

Re: Multiple Ip's

Postby 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. :)
metacyclic
 
Posts: 1
Joined: 2014/05/12 16:25:33


Return to CentOS 6 - Networking Support

Who is online

Users browsing this forum: No registered users and 1 guest