craftkmfk.blogg.se

How to get the mac address on linux
How to get the mac address on linux










how to get the mac address on linux

Now in CentOS 7, ifconfig is not working. In CentOS 6, we used to get MAC address from "ifconfig -a" command and fetching out MAC address by regex (. The iproute2 (ip command) package has supported for macvlans for a long time, so this should work with all recent Linux distros, even including Red Hat 6.In one of the project, client has upgraded their server from CentOS6 to CentOS7. Macvlans are introduced in kernel 2.6.23 as experimental and in 3.9 as production. However, please don't use vlan 1 in a production environment this id can be interpreted as having no vlan at all by some devices. If so, most probably you should assign IP addresses using the ip addr command and bring the interface up with: ip link set dev macvlan1 upĪccording to the question, I used vlan 1 in my examples. Ip link add macvlan2 link eth0.1 type macvlanĬheck with the ip link command if the new interfaces are created. After this, you should add one or more macvlan interfaces like this: ip link add macvlan1 link eth0.1 type macvlan Macvlan's are non-standard and are not related to other network devices.įirst, you should create your vlan interface, as shown in your example. Those can be created on physical as well as on vlan interfaces.

how to get the mac address on linux

Macvlan's are used on Linux systems to provide a separated virtual interface.

how to get the mac address on linux

All used components, including network switches need to be compatible. This means you can create several logical networks on a physical network. A vlan is a common standard (802.1q) for separating broadcast domains. Please note that a vlan and a macvlan are two different things. You might also have to install the vlan or 8021q package (pacman, yum, apt. Some distributions may have it under vlan name.

how to get the mac address on linux

You can see more help with: # ip link helpĪlso check that you have vlan kernel module loaded: # lsmod | grep -i 8021q Main interface is 00:0c:29:ed:ff:ea and vlan is now 00:0c:29:ed:ff:ff. That should be a line wich starts with default (or 0.0.0.0) and have the IP address to the router after. Use ip route list to see which default router your machine have. Use the new command that replace them and can do more, ip (8). Inet6 fe80::2fda:8335:9f2:b9c7/64 scope link 6 Answers Sorted by: 15 Don't use the obsoleted commands ifconfig (8), arp (8) or route (8). Link/ether 00:0c:29:ed:ff:ff brd ff:ff:ff:ff:ff:ff Link/ether 00:0c:29:ed:ff:ea brd ff:ff:ff:ff:ff:ff You can assign VLAN MAC address with ip command: # ip link add link name address type vlan id Įxample: # ip link add link ens33 name myvlan123 address 00:0c:29:ed:ff:ff type vlan id 123Ģ: ens33: mtu 1500 qdisc fq_codel state UP group default qlen 1000












How to get the mac address on linux