Find the answer to your Linux question:
Results 1 to 6 of 6
i have 2 systems, 1 running on centos 5.3 and other 1 on rhel5. I been trying to host mutiple websites on centos (Virtual Hosting), for which i need a ...
  1. #1
    Just Joined!
    Join Date
    May 2011
    Posts
    12

    Unhappy Virtual IP problem on centOS 5.3

    i have 2 systems, 1 running on centos 5.3 and other 1 on rhel5. I been trying to host mutiple websites on centos (Virtual Hosting), for which i need a virtual ip. IP for centos is eth0 :192.168.0.1,Virtual IP on centos is eth0:1 192.168.0.4 and ip for rhel(second sys) is 192.168.0.2. now after configuring virtual ip i cannot ping 192.168.0.1, where as i can ping 192.168.0.4 ( virtual Ip). i cannot ping 192.168.0.1 from rhel nor from centos itself( host unreachable), ofcourse i can ping 192.168.0.4 and 192.168.0.2. really need some help, can some1 help me out plz.THNX

  2. #2
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Sounds like your centos eth0 is not really up. anyway, run this command on both systems and report what it says:
    Code:
    /sbin/ip a

  3. #3
    Just Joined!
    Join Date
    May 2011
    Posts
    12
    the result for 192.168.0.1(centOS)


    1:lo:<LOOPBACK,UP,LOWER_UP> mtu 16436 gdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
    valid_lft forever preffered prefferred_lft forever

    2:eth0:<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 gdisc pfifo_fast qlen 1000
    link/ether 00:0c:29:e5:1b:f4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.4/24 brb 192.168.0.255 scope global eth0
    inet6 fe80::20c:29ff:fee5:1bf4/64 scope link
    valid_lft forever prefferred_lft forever
    3: eth1: <BRAODCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 00:0c:29:e5:1b:fe brb ff:ff:ff:ff:ff:ff
    4: sit0: <NOARP> mtu 1480 qdisc noop
    link/sit 0.0.0.0 brd 0.0.0.0

    result for 192.168.0.2(rhel)

    1:lo:<LOOPBACK,UP,LOWER_UP> mtu 16436 gdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
    valid_lft forever preffered prefferred_lft forever

    2:eth0:<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 gdisc pfifo_fast qlen 1000
    link/ether 00:0c:29:eb:eb:64 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.2/24 brb 192.168.0.255 scope global eth0
    inet6 fe80::20c:29ff:feeb:eb64/64 scope link
    valid_lft forever preffered prefferred_lft forever
    3: sit0: <NOARP> mtu 1480 qdisc noop
    link/sit 0.0.0.0 brd 0.0.0.0

    i wanted to tell u one more thing about configuring eth0:1, i mean how i did it. i got into /etc/sysconfig/network_scripts and from there copied ifcfg-eth0 to ifcfg-eth0:1, i mean i made a new file for eth0:1 and edited the ip and other things coz the command netconfig --device eth0:1 wasn't working. now the file ifcfg-eth0:1 looks as follows.

    device=eth0
    bootproto=none
    braodcast=192.168.0.255
    ipaddr=192.168.0.4
    netmask=255.255.255.0
    network=192.168.0.0
    gateway=192.168.0.254
    type=ethernet
    userctl=no
    ipv6init=no
    peerdns=yes
    hwaddr=00:0c:29:e5:1b:f4
    onboot=no

    do i have to change eth0 to eth0:1 in the first line, plz help.

  4. #4
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Yeah, there's your problem.

    If you look in the output of your 'ip a' command, there is no ip address of 192.168.0.1 for your eth0. The script you made for your eth0 alias is overwriting your default eth0 config file b/c you did not change the name of the device. In your ifcfg-eth0:1 file, change device=eth0 to device=eth0:1 and restart networking...does that fix it?

  5. #5
    Just Joined!
    Join Date
    May 2011
    Posts
    12
    Quote Originally Posted by atreyu View Post
    Yeah, there's your problem.

    If you look in the output of your 'ip a' command, there is no ip address of 192.168.0.1 for your eth0. The script you made for your eth0 alias is overwriting your default eth0 config file b/c you did not change the name of the device. In your ifcfg-eth0:1 file, change device=eth0 to device=eth0:1 and restart networking...does that fix it?
    thanks pal, dat was really helpful, thanks a lot. everything works now, i changed the device to eth0:1 earlier but rather than restarting the system i restarted the netwrok servcie, i never knew that i have to restart the whole system. thanks once again for ur help, very kind of you for quick reply.thnks

  6. #6
    Linux Guru
    Join Date
    May 2011
    Posts
    1,843
    Well, you shouldn't *have* to restart the system just to get the network changes to take effect. A "service network restart" (or similar, depending on your distro) should have done the trick.

    but anyway, glad its working!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...