• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • How to detect new NIC/Ethernet card without rebooting in Linux

    I have a Red Hat 6 vm created in my VMware Workstation Lab. I will just go ahead and add a new NIC card to my running RHEL machine.

    Now let us try to detect it without rebooting the OS

    If we check the output of ifconfig
    # ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:0C:29:B9:4D:D3
              inet addr:192.168.1.11  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::20c:29ff:feb9:4dd3/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:91992 errors:0 dropped:0 overruns:0 frame:0
              TX packets:58283 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:99437002 (94.8 MiB)  TX bytes:5498693 (5.2 MiB)

    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:2964 errors:0 dropped:0 overruns:0 frame:0
              TX packets:2964 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:388592 (379.4 KiB)  TX bytes:388592 (379.4 KiB)

    So as of now the new thernet card configuration is not reflected. There is a file /etc/udev/rules.d/70-persistent-net.rules which contains details about the connected ethernet card in your RHEL box.

    I have discussed about the working of this file in the below link
    device eth0 does not seem to be present, delaying initialization

    In this file you can view the details of the newly connected Ethernet Card





    # PCI device 0x8086:0x100f (e1000)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="
    00:0c:29:b9:4d:d3", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

    # PCI device 0x8086:0x100f (e1000)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b9:4d:dd", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

    As you see it shows two ethernet card details i.e. eth0 and eth1. As of now eth0 is already in connected state as per the output of ifconfig which can also match using the MAC details. So let us manually create a new configuration file for the new card.
    # cd /etc/sysconfig/network-scripts
    To skip the hard work let us copy the contents from eth0 to our new file, in that way we will just have to make required changes
    # cp ifcfg-eth0 ifcfg-eth1



    Lines marked in blue are the one you need to change as per your environment
    # vi ifcfg-eth1
    DEVICE=eth1
    TYPE=Ethernet
    ONBOOT=yes
    NM_CONTROLLED=no
    BOOTPROTO=none
    HWADDR=00:0c:29:b9:4d:dd
    IPADDR=192.168.1.5
    PREFIX=24
    GATEWAY=192.168.1.1
    DNS1=8.8.8.8

    DEFROUTE=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=no
    NAME="System eth1"

    Restart your network services
    # service network restart
    Shutting down interface eth0:                              
    [  OK  ]
    Shutting down loopback interface:                          [  OK  ]
    Bringing up loopback interface:                            [  OK  ]
    Bringing up interface eth0:  Determining if ip address 192.168.1.11 is already in use for device eth0...
                                                               [  OK  ]
    Bringing up interface eth1:  Determining if ip address 192.168.1.5 is already in use for device eth1...
                                                               [  OK  ]

    Verify your results
    # ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:0C:29:B9:4D:D3
              inet addr:192.168.1.11  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::20c:29ff:feb9:4dd3/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:92368 errors:0 dropped:0 overruns:0 frame:0
              TX packets:58550 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:99470396 (94.8 MiB)  TX bytes:5531059 (5.2 MiB)

    eth1      Link encap:Ethernet  HWaddr 00:0C:29:B9:4D:DD
              inet addr:192.168.1.5  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::20c:29ff:feb9:4ddd/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:3 errors:0 dropped:0 overruns:0 frame:0
              TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:372 (372.0 b)  TX bytes:636 (636.0 b)


    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:2964 errors:0 dropped:0 overruns:0 frame:0
              TX packets:2964 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:388592 (379.4 KiB)  TX bytes:388592 (379.4 KiB)

    I hope that was helpful. Let me know your success and failures

    Related Articles
    Creating an internal network using VMware Workstation
    How to do Ethernet/NIC bonding/teaming in Red Hat Linux
    How to configure network in Red Hat Linux
    Configure network in Solaris 10

    Deepak Prasad

    is a techie and an author who is still trying to survive in this IT generation with very little knowledge he has on Linux/Unix, VMware, SAN Storage, Automation, networking etc

    You can follow him on Facebook or Google+


    Do you also have something to share here?
    Join GoLinuxHub Team as an Author, Click here for more information
    How to detect new NIC/Ethernet card without rebooting in Linux How to detect new NIC/Ethernet card without rebooting in Linux Reviewed by Deepak Prasad on Wednesday, July 23, 2014 Rating: 5

    1 comment:

    Powered by Blogger.