• Learning Map
  • Unix Quiz Center
  • Unix Professional Network
  • Just-Unix-No-Noise FB Group

unixadminschool.com

  • Home
  • Announcements
    • Feed
    • MISC
  • Beginners zone
    • Beginners Lessons
    • Career Guidance
  • Experts Zone
    • Cloud Computing
    • Configuration Solutions
    • Migrations
    • Network Design
    • Scripting
    • Server Security
    • SUN CLUSTERS
    • SUN LDOMS
    • Tools & Applications
    • Veritas Cluster Services ( VCS ) Learning
  • Intermediate Zone
    • Linux Learning
      • Linux Booting
      • Linux Disk Management
      • Linux LVM
      • Linux Networking
      • Linux Performance
      • Linux Troubleshooting
      • Linux YUM/RPM
      • Performance Analysis
      • Redhat Linux Kernel
      • RHEL 6
        • RHEL LDAP
        • Rhel6 Storage
      • Web Servers
    • Solaris Admin
      • Blog for Unix Admin
        • Storage Administration – SAN
      • Oracle Hardware
      • Reference Docs
      • Solaris 10 Zones & LDOMs
      • Solaris 11
      • Solaris Access Control
      • Solaris Best Practices
      • Solaris Booting
      • Solaris Disk Management
      • Solaris DNS
      • Solaris How-to
      • Solaris Installation
      • Solaris Kernel
      • Solaris Networking
      • Solaris NFS
      • Solaris NIS
      • Solaris Packages & Patching
      • Solaris Performance
      • Solaris Tips
      • Solaris Troubleshooting
      • Solaris User Authentication
      • solaris X86
      • Solaris ZFS and Boot Environment
      • Storage Configurations
      • SUN Hardware
      • Troubleshooting Flow charts
    • Veritas Admin
      • Veritas Netbackup
      • VxVM Learning
      • VxVM Troubleshooting
  • QUIZ Center
  • Vlabs

Subscribe

VMWARE Linux – Adding a Second NIC for a Guest Linux VM – With No Service Disruption

This is post is to explain the  configuration of  a linux VM with a secondary NIC  without reboot or restart network services. This is fairly simple and straight forward task, but I am just posting it for the folks who are new for the Linux VM on Vmware.

 

Unlike physical systems you don’t need to shutdown the box to add new physical NIC card ( just in case if you don’t have enough on board interface) . Once the VMWARE engineer creates a Virtual NIC on Hypervisor and attach it to our system, linux will automatically recognize the new device and will show you in the ifconfig output.

In the blow example, the scenario is we are actually configuring a secondary interface and attaching a network IP to it, and then we are adding additional static routes for the secondary IP.

Below is the Initial configuration, before detecting the new NIC port:

[root@gurkullinuxVM ~]# ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:50:56:20:26:24

          inet addr:199.9.200.101 Bcast:14.129.48.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:224666676 errors:0 dropped:0 overruns:0 frame:0

          TX packets:161900293 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:5000

          RX bytes:41534486993 (38.6 GiB)  TX bytes:145549058043 (135.5 GiB)

 

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:163605347 errors:0 dropped:0 overruns:0 frame:0

          TX packets:163605347 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:2256211008871 (2.0 TiB)  TX bytes:2256211008871 (2.0 TiB)

 

 Below is the original Static route configuration before adding additional routes

# netstat -rn

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

100.10.103.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1

199.9.200.101     0.0.0.0         255.255.255.0   U         0 0          0 eth0

0.0.0.0         199.9.200.1     0.0.0.0         UG        0 0          0 eth0

 Current eth0 configuration file as below

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

DEVICE=eth0

BOOTPROTO=static

IPADDR=199.9.200.101

NETMASK=255.255.255.0

ONBOOT=yes

$

 

And once the VMWare engineer configures the additional nic for the linux box, the nic port will be automatically visible in the system. And you can see eth1 in the  below ifconfig output

 

[root@gurkullinuxVM ~]# ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:ab:56:20:26:24

          inet addr:199.9.200.101Bcast:14.129.48.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:225650315 errors:0 dropped:0 overruns:0 frame:0

          TX packets:162774611 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:5000

          RX bytes:39536609117 (36.8 GiB)  TX bytes:146395475846 (136.3 GiB)

 

eth1      Link encap:Ethernet  HWaddr 00:ab:56:9C:2A:FC

          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)

 

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:163611622 errors:0 dropped:0 overruns:0 frame:0

          TX packets:163611622 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:2256212079066 (2.0 TiB)  TX bytes:2256212079066 (2.0 TiB)

 

 

Then we have create a new ethernet configuration file for the eth1 as below

$ cat ifcfg-eth1

DEVICE=eth1

BOOTPROTO=static

IPADDR=100.10.103.71

NETMASK=255.255.255.0

ONBOOT=yes

TYPE=Ethernet

 Before you bring up the additional NIC just test for link connection using the ethtool as below

[root@gurkullinuxVM network-scripts]# ethtool eth1

Settings for eth1:

        Supported ports: [ TP ]

        Supported link modes:   1000baseT/Full

                               10000baseT/Full

        Supports auto-negotiation: No

        Advertised link modes:  Not reported

        Advertised auto-negotiation: No

        Speed: 10000Mb/s

        Duplex: Full

        Port: Twisted Pair

        PHYAD: 0

        Transceiver: internal

        Auto-negotiation: off

        Supports Wake-on: uag

        Wake-on: d

        Link detected: yes

 

 

 And once we know the interface is available and the “Link Detected = yes”, we can bring up the additional interface using the configuration we entered in “/etc/sysconfig/network-scripts/ifcfg-eth1″ , using the below command.

 

# ifup eth1

Setting ringbuffer settings to maximum for eth1

Increasing txqueuelen for eth1 (from 1000 to 5000)

 

then we can check the new configuration from the ifconfig output as below

 

[root@gurkullinuxVM  network-scripts]# ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:ab:56:20:26:24

          inet addr:199.9.200.101 Bcast:14.129.48.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:226458330 errors:0 dropped:0 overruns:0 frame:0

          TX packets:163348262 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:5000

          RX bytes:39708756293 (36.9 GiB)  TX bytes:147033108626 (136.9 GiB)

 

eth1      Link encap:Ethernet  HWaddr 00:ab:56:9C:2A:FC

          inet addr:100.10.103.71  Bcast:100.10.103.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:735 errors:0 dropped:0 overruns:0 frame:0

          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:5000

          RX bytes:49548 (48.3 KiB)  TX bytes:1120 (1.0 KiB)

 

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:163619066 errors:0 dropped:0 overruns:0 frame:0

          TX packets:163619066 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:2256213415106 (2.0 TiB)  TX bytes:2256213415106 (2.0 TiB)

 

Now the second task is additing static routes for the new IP connection ( i.e. eth1). For that purpose  we have to configure the file “/etc/sysconfig/network-scripts/route-eth1″ as shown below. And each entry talks about one route.

 

Entry format :  

<Destination Network address >/ <Desitnation Subnetmask >  via   <Gateway>  dev <network interface>

$ cat route-eth1

100.10.101.0/24 via 100.10.103.1 dev eth1

100.10.102.0/24 via 100.10.103.1 dev eth1

100.10.103.0/24 via 100.10.103.1 dev eth1

100.10.104.0/24 via 100.10.103.1 dev eth1

 Once you have the static route information ready in the file “route-eth1″, you just have to make them active using the below command. Please note that in the below command I am just using the eth1 , which doesn’t affect the existing interface.

 

# ./ifup-routes eth1

 

 

 Now you can check the new route configuration with netstat command as given below:

 

$ netstat -rn

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

100.10.101.0     100.10.103.1     255.255.255.0   UG        0 0          0 eth1

100.10.103.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1

100.10.102.0     100.10.103.1     255.255.255.0   UG        0 0          0 eth1

199.9.200.101     0.0.0.0         255.255.255.0   U         0 0          0 eth0

100.10.104.0     100.10.103.1     255.255.255.0   UG        0 0          0 eth1

0.0.0.0         199.9.200.1    0.0.0.0         UG        0 0          0 eth0

$

 

That’s it for the day

You might be interested to read below :


  • Test Your Understanding about Linux Fundamentals

  • RHEL 6 – ISCSI Administration Series – ISCSI Lun resize

  • RHEL 6 – ISCSI Administration Series – Configuring ISCSI Server and Client

  • SAN Storage Migration – Solaris with VxVM

  • RHEL 6.3 – LDAP Series – Part 4 : Troubleshooting

  • RHEL 6.3 – LDAP Series – Part 3 : LDAP Configuration With Encrypted Communication using TLS/SSL
  • Email
  • More
  • Print
  • Digg
Posted by Ramdev
Comment it
Tagged with: [ hardware, linux learning, linux training, linux virtual machine, nic, vmware ]
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Comment

Join to our Professional Network (of 1400+ unixadmins ) to receive Unix Administration and Job Updates -

Pages1

Don't Miss Updates

 

Beginners Zone

 

Unixadmin Careers

Server Hardware

Beginners Lessons

Troubleshooting-Flowchart

 

Intermediate Zone

 

Solaris Booting

Solaris Volume Manager

Storage Configurations

Solaris Networking

Solaris X86

Solaris ZFS

Solaris NFS

Solaris NIS

Solaris Patching

Solaris Booting

Solaris Kernel

Veritas Volume Manager

Solaris NIS

Logical Volume Manager

Linux Networking

Linux Disk Management

Linux Troubleshooting

 

Experts Zone 

 

Solutions

Scripting and Automation

Server Security

Veritas Cluster Services

Sun Cluster Services

Cloud Computing

SUN LDOMS

Copyright © 2009 unixadminschool.com. All rights reserved.
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.