Tuesday, November 18, 2014

Changing the interface eth3 to eth0 on Redhat 6.3

This is what I got from application team.


Hi Engineering Team,
        Could you please configure all the HW address point to eth0 rather than eth2 on all the hosts? We are having issues with licensing with this.  These are new VM builds and are having these issues.
lnxprodsrv02
lnxprodsrv03
lnxprodsrv04


---------------------------------------------------------------------------------------------
OK, these servers were built using VMware. In fact, new server is going to be the clone of an existing system. Redhat 5.x kept the same interface. After the completion of the build, we need to add a new interface and use ethtool to verify the correct interface.  But in case of Redhat 6.x, once the server is built, the interface changed to eth2 directly. But it worked perfectly. However, out application team has a software which counts the number of interface. I think they have bug but it query the number of interface. Since the active interface on the system was eth2, it assume that we are using 3 interface so we have to pay the license for 3 interface rather then one. So, they requested to change the interface from eth2 to eth0. Here is what you have to do,



1. In the persistent rules file (/etc/udev/rules.d/70-persistent-net.rules), comment out the first two interfaces and changed the name of the third to eth0


[root@lnxprodsrv02 ~]# cd /etc/udev/rules.d/
[root@lnxprodsrv02 rules.d]# ls -l 70-persistent-net.rules
-rw-r--r-- 1 root root 754 May  9 16:48 70-persistent-net.rules


[root@lnxprodsrv02 rules.d]# cat 70-persistent-net.rules
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:91:25:12", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:91:23:63", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bf:52:5d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"


[root@lnxprodsrv02 rules.d]# cp -p /etc/sysconfig/network-scripts/ifcfg-eth2 /etc/sysconfig/network-scripts/ifcfg-eth2.origg

[root@lnxprodsrv02 rules.d]# vi /etc/udev/rules.d/70-persistent-net.rules
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:91:25:12", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:91:23:63", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bf:69:3f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"



# nexec lnxprodsrv02 mv /etc/sysconfig/network-scripts/route6-eth2 /etc/sysconfig/network-scripts/route6-eth0
# nexec lnxprodsrv02 vi /etc/sysconfig/network-scripts/ifcfg-eth0



2. In /etc/sysconfig/network-scripts/ifcfg-eth2, add the HWADDR from your new eth0 and changed the device to eth0. Then rename the file to ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth2

[root@lnxprodsrv02 rules.d]# cat /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
USERCTL=no
BOOTPROTO=static
NETMASK=255.255.254.0
IPADDR=172.28.27.225
PEERDNS=no
check_link_down() {
 return 1;
}

[root@lnxprodsrv02 rules.d]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=lnxprodsrv02



[root@lnxprodsrv02 rules.d]# ifconfig -a
eth2      Link encap:Ethernet  HWaddr 00:50:56:BF:52:5D
          inet addr:172.28.28.225  Bcast:172.28.28.255  Mask:255.255.254.0
          inet6 addr: fe80::250:56ff:febf:525d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5489372 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2004461 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4371371748 (4.0 GiB)  TX bytes:10531360073 (9.8 GiB)
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:159886 errors:0 dropped:0 overruns:0 frame:0
          TX packets:159886 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:28644597 (27.3 MiB)  TX bytes:28644597 (27.3 MiB)



3. Renamed route-eth2 to route-eth0
mv /etc/sysconfig/network-scripts/route-eth2 /etc/sysconfig/network-scripts/route-eth0
mv /etc/sysconfig/network-scripts/route6-eth2 /etc/sysconfig/network-scripts/route6-eth0


4. reboot

You should have new interface.


Another way of doing the same task is to make a copy of interface config and delete all the interface from VMware, add new interface and assign the ip address. Reboot to confirm.

No comments:

Post a Comment