You are not logged in.
What is the best way to create MAC spoofing (MAC address change) on system boot via systemd?
It would be good if i could use it with any service (netcfg, dhcp, networkmanager).
I used to do it with hooks in /etc/rc.d (https://wiki.archlinux.org/index.php/MA … AC_On_Boot). It works fine with any daemon (network, net-pofiles and networkmanager).
For example, following .service-file works (based on dhcp@.service) but sometimes fails with "ip: Interface 'eth0' not found"
[Unit]
Description=dhcpcd on %I
Wants=network.target
Before=network.target
[Service]
Type=forking
PIDFile=/run/dhcpcd-%I.pid
ExecStartPre=/usr/sbin/ip link set dev %I address XX:XX:XX:XX:XX:XX
ExecStart=/sbin/dhcpcd -A -q -w %I
ExecStop=/sbin/dhcpcd -k %I
[Install]
Alias=multi-user.target.wants/dhcpcd@eth0.serviceBy using
After=sys-devices-pci0000:00-0000:00:0a.0-net-eth0.devicein Unit section it is still very unstable.
Any solutions?
Sorry my english
Offline
I use netcfg (PRE_UP) for mac spoofing. See wiki for more details.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
net-auto-wired.service doesn't work for me (but with sysvinit (as daemon) does work):
Aug 17 15:41:15 segrived-nb ifplugd[169]: Executing '/etc/ifplugd/netcfg.action eth0 up'.
Aug 17 15:41:16 segrived-nb ifplugd[169]: client: up
Aug 17 15:41:16 segrived-nb ifplugd[169]: Program execution failed, return value is 1netcfg@.service works, but have some issues, if i start system with unplugged cable:
* interface not up after cable connect
* sometimes it break systemd output (login prompt without clearing the screen)
Also, this solution works only with netcfg, and i want it to work with networkmanager
Previously i used this hook and this code worked with no problems.
# Configuration file
. /etc/conf.d/macspoof
hook_macspoof() {
stat_busy "Spoofing Media Access Control (MAC)"
ip link set dev ${INTERFACE} address ${MAC}
stat_done
}
add_hook sysinit_end hook_macspoofLast edited by segrived (2012-08-17 19:31:55)
Offline
If you are using NetworkManager, then the correct place to change the mac would be the setting in the connection profile.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline