• 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.

  • Life always offers you a second chance ... Its called tomorrow !!!

    Monday, November 24, 2014

    How to change the MAC Address of Ethernet device in Linux?

    In case you have added a new ethernet device to your machine or server, How would you determine the new MAC Address and update the same to its relative configuration file?

    You can check for the MAC address of an ethernet card using below command
    # ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:0C:29:A3:F5:E6
              inet addr:192.168.1.6  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::20c:29ff:fea3:f5e6/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:356 errors:0 dropped:0 overruns:0 frame:0
              TX packets:322 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:38162 (37.2 KiB)  TX bytes:59986 (58.5 KiB)
              Interrupt:19 Base address:0x2024

    But this command will show the MAC details of configured ethernet device. In case you have added a new ethernet card, ifconfig won't show the output of that new device

    To get the same for new ethernet card use the below command
    # ip link
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
        link/ether 00:0c:29:a3:f5:e6 brd ff:ff:ff:ff:ff:ff
    3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
        link/ether 00:0c:29:a3:f5:f0 brd ff:ff:ff:ff:ff:ff
    4: pan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
        link/ether 3e:ef:ea:16:07:bc brd ff:ff:ff:ff:ff:ff

    As you see it is showing the MAC details of all the connected ethernet cards

    You can aslo verify the same from the below file
    # grep eth1 /etc/udev/rules.d/70-persistent-net.rules
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a3:f5:f0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

    In case you don't know the device name lookout for the newly added device by viewing the file
    # less /etc/udev/rules.d/70-persistent-net.rules
    # PCI device 0x1022:0x2000 (vmxnet) (custom name provided by external tool)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a3:f5:e6", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

    # PCI device 0x1022:0x2000 (vmxnet)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a3:f5:f0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

    Next once you know the Hardware Address of your ethernet device update the same in the configuration file

    You can learn how to create or configure network in Red Hat Linux using the below link
    How to configure network in Red Hat Linux

    Follow the below links for more tutorials

    How to find the path of any command in Linux
    How to configure a Clustered Samba share using ctdb in Red Hat Cluster
    How to delete an iscsi-target from openfiler and Linux
    How to perform a local ssh port forwarding in Linux
    How to use yum locally without internet connection using cache?
    What is umask and how to change the default value permanently?
    Understanding Partition Scheme MBR vs GPT
    How does a successful or failed login process works in Linux
    How to find all the process accessing a file in Linux
    How to exclude multiple directories from du command in Linux
    How to configure autofs in Linux and what are its advantages?
    How to resize software raid partition in Linux
    How to configure Software RAID 1 mirroring in Linux
    How to prevent a command from getting stored in history in Linux

    0 comments:

    Post a Comment