Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have the following problem:

My server was given two IPs from [b]different[/b] subnets. Now I am trying to configure the system to work properly. I have created

[root@server ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
HWADDR=00:30:48:DA:B1:0E
DEVICE=eth0
BOOTPROTO=none
BROADCAST=79.174.69.255
IPADDR=79.174.69.241
NETMASK=255.255.254.0
NETWORK=79.174.68.0
ONBOOT=yes
GATEWAY=79.174.68.1
TYPE=Ethernet

[root@server ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0:0
# Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
HWADDR=00:30:48:DA:B1:0E
DEVICE=eth0
BOOTPROTO=none
BROADCAST=79.174.69.255
IPADDR=79.174.71.74
NETMASK=255.255.255.0
NETWORK=79.174.71.1
ONBOOT=yes
GATEWAY=79.174.71.1
TYPE=Ethernet

But both after "service network restart" and after "reboot"

[root@server ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:30:48:DA:B1:0E
          inet addr:79.174.71.74  Bcast:79.174.71.255  Mask:255.255.255.0
          inet6 addr: fe80::230:48ff:feda:b10e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:910284 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2924 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:257964879 (246.0 MiB)  TX bytes:232450 (227.0 KiB)
          Memory:df220000-df240000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:27 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6976 (6.8 KiB)  TX bytes:6976 (6.8 KiB)

Device eth0:0 is not shown as active. If I try

[root@server ~]# ifconfig eth0:0
eth0:0    Link encap:Ethernet  HWaddr 00:30:48:DA:B1:0E
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Memory:df220000-df240000

It is shown as up and running, but IP is not assigned to it.

Also it is strange, that IP address assigned to eth0:0 in config file is used by eth0.

/var/log/messages shows nothing about network configuration errors on either eth0 or eth0:0. system-config-network seem to understand all settings correctly and resaves them ok also.

"ifup eth0:0" executes ok, but ifconfig afterwards shows no eth0:0 device after that.

What did I do wrong? May be the problem is that IPs are from different subnets?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

eth0 and eth0:0 are the same interface. Use eth0:1 for an alias.

Could it be that DEVICE=eth0 should actually be DEVICE=eth0:0?

share|improve this answer
    
Well spotted :) –  rkthkr Apr 15 '10 at 6:40
    
That is not correct: kbase.redhat.com/faq/docs/DOC-6133 | centos.org/docs/5/html/Deployment_Guide-en-US/… | faqs.org/docs/Linux-mini/IP-Alias.html eth0:0 is a correct alias. My second CentOS server is using it and works ok. –  FractalizeR Apr 15 '10 at 7:01
    
@FractalizeR: I remember I stopped eth0:0 by mistake once and it brought down the whole interface, but it was on Ubuntu. Or I remember wrong. Anyway, I have edited the post with a different attempt. –  Dan Andreatta Apr 15 '10 at 7:10
    
Yes, I've just spotted that it should be DEVICE=eth0:0! The problem arose when I misconfigured IPs on network card and asked hoster to correct this problem and to bring up second IP on virtual adapter. My god.. –  FractalizeR Apr 15 '10 at 7:10
    
@FractalizeR: Don't be so hard on yourself. I had to drive to the colo place because a server would not come up for a similar misconfiguration... and Ubuntu will fail all interfaces if one is misconfigured... –  Dan Andreatta Apr 15 '10 at 8:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.