Answer the question
In order to leave comments, you need to log in
What is the error in the implementation of the script to change the poppy address?
I am new to this. I'm trying to implement a regular script to change the poppy address.
On the command line, I can change it with:
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether adress
sudo ifconfig eth0 up
When I make a script, I get an error all the time. What is the problem?
SIOCSIFFLAGS: Operation not permitted
SIOCSIFHWADDR: Operation not permitted
SIOCSIFFLAGS: Operation not permitted
#!/usr/bin/env python
import subprocess
subprocess.call("ifconfig eth0 down", shell=True)
subprocess.call("ifconfig eth0 hw ether 00:11:22:33:44:66", shell=True)
subprocess.call("ifconfig eth0 up", shell=True)
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::a00:27ff:fea6:1f86 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:a6:1f:86 txqueuelen 1000 (Ethernet)
RX packets 333400 bytes 497332684 (474.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 158722 bytes 9660948 (9.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 118 bytes 18510 (18.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 118 bytes 18510 (18.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Answer the question
In order to leave comments, you need to log in
SIOCSIFFLAGS: Operation not permitted
SIOCSIFHWADDR: Operation not permitted
SIOCSIFFLAGS: Operation not permitted
#!/usr/bin/env python
import subprocess
subprocess.call("sudo ifconfig eth0 down", shell=True)
subprocess.call("sudo ifconfig eth0 hw ether 00:11:22:33:44:66", shell=True)
subprocess.call("sudo ifconfig eth0 up", shell=True)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question