Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

ifconfig question

  • 04-07-2008 3:01pm
    #1
    Registered Users, Registered Users 2 Posts: 23,212 ✭✭✭✭


    Not sure if this should be in Net/Comms, but I'll give it a try here and see.

    I have two network cards in a machine, below is the output from ifconfig:
    eth0 Link encap:Ethernet HWaddr 00:14:5E:28:31:1A
    inet addr:10.132.8.152 Bcast:10.132.8.255 Mask:255.255.255.0
    inet6 addr: fe80::214:5eff:fe28:311a/64 Scope:Link
    UP BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
    Interrupt:169

    eth1 Link encap:Ethernet HWaddr 00:14:5E:28:31:1B
    inet addr:10.1.5.154 Bcast:10.1.255.255 Mask:255.255.0.0
    inet6 addr: fe80::214:5eff:fe28:311b/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:592729804 errors:0 dropped:0 overruns:0 frame:0
    TX packets:429948227 errors:2446 dropped:0 overruns:0 carrier:0
    collisions:59995992 txqueuelen:1000
    RX bytes:288372479411 (268.5 GiB) TX bytes:80065884646 (74.5 GiB)
    Interrupt:169

    Notice the difference - eth0 does not have the RUNNING piece in the output. I am connected in via eth1.

    Can anyone tell me if it is simply a case of eth0 may have no cable attached? Or is there something else I may be missing?


Comments

  • Registered Users, Registered Users 2 Posts: 1,065 ✭✭✭Snowbat


    Not having a cable attached to eth0 is certainly a possibility. I see this if I bring up eth1 with no cable attached.


  • Closed Accounts Posts: 1,506 ✭✭✭Jackz


    Can you run route -n to see what gateway is associated with that interface?

    If you can tell from the output (10.132.8.254) try to ping it.



    If the ping is good use traceroute -i eth0 <gateway ip> to ensure you are not geting to the gateway via another route (throught the eth1 interface).

    (You could also traceroute -i eth0 google.com, no hops will show that the interface is down if you can normally reach the net from the box.)

    Hmmm anything from dmesg or in boot log to show link-down or cable problem error for this interface?

    Try ifup eth0 to see if there are any errors, failing that you might have: no cable, bad cable or fecked switch.


  • Registered Users, Registered Users 2 Posts: 159 ✭✭TeaServer


    Normally the interface will not be 'RUNNING' if the cable is disconnected. Another option you should also check is speed, duplex and auto-negiotation settings on the interface and switch its connected to.

    If all this is good, it's probably a dodgy cable or connector.


  • Registered Users, Registered Users 2 Posts: 23,212 ✭✭✭✭Tom Dunne


    Thanks for the replies - in the end it was the cable.

    The reason I wasn't able to immediately check was that it is a client's machine, I was connected in via VPN, so I had no physical access to it.


  • Registered Users, Registered Users 2 Posts: 23,212 ✭✭✭✭Tom Dunne


    Just another question on this - when I reboot the box, the ip address for eth0 is lost. I have to manually re-enter it. (eth1 was the primary, and continues to work without problem).

    I can't see a switch on the ifconfig command to make it permanent, so is there something else I need to do? I'm on Red Hat Enterprise, btw.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,621 ✭✭✭GreenHell


    /etc/sysconfig/network-scripts/ifcfg-eth0

    Should be able to make all the changes you need there to eth0.


  • Registered Users, Registered Users 2 Posts: 564 ✭✭✭fishfoodie


    If an interface isn't getting its IP you might want to check that you have an entry in your /etc/hosts for each interface & that each interface has a unique hostname.

    Most startup scripts do a round-robin for each interface & grep its IP from /etc/hosts based on the hostname set for that interface.


  • Registered Users, Registered Users 2 Posts: 23,212 ✭✭✭✭Tom Dunne


    GreenHell wrote: »
    /etc/sysconfig/network-scripts/ifcfg-eth0

    Should be able to make all the changes you need there to eth0.

    Bah, no wonder I couldn't find it. I was looking for something like /etc/network.

    fishfoodie wrote: »
    If an interface isn't getting its IP you might want to check that you have an entry in your /etc/hosts for each interface & that each interface has a unique hostname.

    Most startup scripts do a round-robin for each interface & grep its IP from /etc/hosts based on the hostname set for that interface.

    I think that was another of my problems - had manually entered the new IP address, with the same hostname as the original (so I had two addresses, one hostname).

    I did a combination of both of the above and it worked.

    Thanks again.


  • Registered Users, Registered Users 2 Posts: 23,212 ✭✭✭✭Tom Dunne


    Ok, sorry for doing yet another bump, but I have yet another question (remember, I am a DBA, doing a Linux system admin's job :)).

    When I have two network cards, as above, connected in via eth0, and I bring eth1 down via the command "ifconfig eth1 down", I lost connection on eth0 (different IP address).

    Any idea why that happens? Is there another way I can bring eth1 down, without affecting my connecting via eth0?


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    Can you show us the output for ifconfig before and after? That shouldn't happen.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,621 ✭✭✭GreenHell


    Strange one alright.

    I'd try to verify that you are actually connecting on eth0, with an ifconfig.


  • Registered Users, Registered Users 2 Posts: 23,212 ✭✭✭✭Tom Dunne


    Crap, same thing happens when I use ifdown eth0

    Here's the pre- ifconfig eth0 down output from ifconfig:
    eth0 Link encap:Ethernet HWaddr 00:14:5E:28:2F:A6
    inet addr:10.1.16.2 Bcast:10.1.255.255 Mask:255.255.0.0
    inet6 addr: fe80::214:5eff:fe28:2fa6/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:168845 errors:0 dropped:0 overruns:0 frame:0
    TX packets:15802 errors:2 dropped:0 overruns:0 carrier:0
    collisions:4939 txqueuelen:1000
    RX bytes:27853156 (26.5 MiB) TX bytes:3261624 (3.1 MiB)
    Interrupt:169

    eth1 Link encap:Ethernet HWaddr 00:14:5E:28:2F:A7
    inet addr:10.1.5.152 Bcast:10.1.255.255 Mask:255.255.0.0
    inet6 addr: fe80::214:5eff:fe28:2fa7/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:35115 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:6133651 (5.8 MiB) TX bytes:0 (0.0 b)
    Interrupt:169

    Now, the strange thing is, even though I used ifconfig eth0 down yesterday, and was disconnected, it (eth0) is back up and running today and I can connect without problem.

    The uptime on the box is 300+ days, so it wasn't rebooted overnight.


  • Registered Users, Registered Users 2 Posts: 2,621 ✭✭✭GreenHell


    Have a look in /var/log/messages for any errors, why your connection dropped.

    Also, try reconfiguring your networking settings with

    system-config-network-tui

    I'm assuming your using RHEL4+ so that command should work fine from commandline

    When you do an ifconfig eth0 down, while connected on eth1, it could a security feature, but for the life of me I can't think what it could be.


  • Registered Users, Registered Users 2 Posts: 564 ✭✭✭fishfoodie


    Are you sure eth0 is actually going down ?
    It could be that all traffic is being routed out thru one interface. Do a netstat -rn to check the routing.


  • Registered Users, Registered Users 2 Posts: 23,212 ✭✭✭✭Tom Dunne


    fishfoodie wrote: »
    Are you sure eth0 is actually going down ?
    It could be that all traffic is being routed out thru one interface. Do a netstat -rn to check the routing.

    As I am being disconnected, I am pretty sure. :)
    GreenHell wrote: »
    /etc/sysconfig/network-scripts/ifcfg-eth0

    Should be able to make all the changes you need there to eth0.

    I went for this method in the end - instead of using ifconfig/ifdown/ifup. I just manually edited the above file, rebooted and it worked fine. Brings me back to my Windows days. I really hoped I could do it without rebooting the machine. Oh well, at least I know what to do on the live production systems. :eek:


  • Registered Users, Registered Users 2 Posts: 564 ✭✭✭fishfoodie


    I just had another look at stats in the ifconfig output you posted & it confirmed what I thought. All your outgoing packets are routed thru the eth0 interface. Compare the TX stats highlighted below.

    So if eth0 goes down you loose connectivity. Using the Redhat tools probably sorted out the routing tables so that both interfaces can route to you gateway.
    eth0 Link encap:Ethernet HWaddr 00:14:5E:28:2F:A6
    inet addr:10.1.16.2 Bcast:10.1.255.255 Mask:255.255.0.0
    inet6 addr: fe80::214:5eff:fe28:2fa6/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:168845 errors:0 dropped:0 overruns:0 frame:0
    TX packets:15802 errors:2 dropped:0 overruns:0 carrier:0
    collisions:4939 txqueuelen:1000
    RX bytes:27853156 (26.5 MiB) TX bytes:3261624 (3.1 MiB)
    Interrupt:169

    eth1 Link encap:Ethernet HWaddr 00:14:5E:28:2F:A7
    inet addr:10.1.5.152 Bcast:10.1.255.255 Mask:255.255.0.0
    inet6 addr: fe80::214:5eff:fe28:2fa7/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:35115 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:6133651 (5.8 MiB) TX bytes:0 (0.0 b)
    Interrupt:169


  • Registered Users, Registered Users 2 Posts: 2,621 ✭✭✭GreenHell


    You don't need to reboot once you've made a change to those files

    "service network restart" will do the job for you, save you a bit of hassle.


  • Registered Users, Registered Users 2 Posts: 23,212 ✭✭✭✭Tom Dunne


    That's brilliant to know, thanks. I will be looking at it when I get into work and will give it a go.

    Means I won't have to be continually resarting my DB too.


Advertisement