phplkak.blogg.se

Get mac address from linux command line
Get mac address from linux command line




get mac address from linux command line

The folks at the data centre were nice enough to tell me that all I had to do to connect my server to the network again was to delete a single file called Updating CentOS with the current MAC address The first one is the MAC address for our wired LAN connection, the second one is for the WLAN address and the third one for the local loopback.Įquipped with this knowledge, let’s tweak the system file that contains a record to the previous MAC address.

get mac address from linux command line

Hence, to have a look at all our current MAC addresses, we can read all address files like so: cat /sys/class/net/*/address If eth0 is down, there’s no folder called eth0. The thing is though that a folder like eth0 will only exist if eth0 is indeed a valid connection. Those are updated on the fly and should always be up to date with whatever hardware we’re using. Each of these contains a file called address in which we can see our current MAC address. In it we’ll find sub-folders corresponding to our connections (such as eth0, lo, wlan, etc). There’s a system folder called /sys/class/net. We know why: because our MAC address has changed, and CentOS is trying to talk to hardware that doesn’t respond. This tells us that eth0 appears to be unavailable, probably because it could not be brought up.

get mac address from linux command line

The following command will give us an overview: ip addr showġ: lo: mtu 65536 qdisc noqueue state UNKNOWN

get mac address from linux command line

Checking Interfaces and Connectionsīefore we begin, let’s see what the system looks like in its current (mis-)configured state. Here’s how I fixed the problem. I did this on a CentOS 6 server, but it looks like the procedure is the same for CentOS 7. CentOS stores this value in two of its files, and when it changes (which is hardly ever the case), those files need to be updated. Although my data was save, the server wouldn’t connect to the network anymore – because it had a new MAC address. Lucky for me, the data centre could simply swap out my hard disks and put them into another server. I had an issue with one of my servers the other day: its power supply died unexpectedly during a scheduled restart.






Get mac address from linux command line