Avatar of LuiLui77
LuiLui77

asked on 

"siocsifhwaddr cannot assign requested address" when running python script

Hello All,
when running the below python script from the terminal to change an interface MAC, I get the following message: "siocsifhwaddr cannot assign requested address"

any ideas of what could be happening?

---------------------------------------------------------------------------------------------------------------------------------
#!/usr/bin/env python

import subprocess

interface = "eth0"
new_mac = "11:22:33:44:55:11"
print("[+] Changing MAC for " + interface + " to " + new_mac)

subprocess.call("ifconfig " + interface + " down", shell=True)
subprocess.call("ifconfig " + interface + " hw ether " + new_mac, shell=True)
subprocess.call("ifconfig " + interface + " up", shell=True)

-----------------------------------------------------------------------------------------------------------------------------------------
LinuxShell ScriptingPython

Avatar of undefined
Last Comment
Iamthecreator OM
ASKER CERTIFIED SOLUTION
Avatar of Iamthecreator OM
Iamthecreator OM
Flag of France image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of LuiLui77
LuiLui77

ASKER

Both links helped, the MAC address was not unicast.

Thank you!
You are welcome!
Linux
Linux

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

71K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo