You are not logged in.
Hello. My ISP remembers the mac adresses. So to use internet on my linux machine, I mask it with macchanger (as root!):
/etc/rc.d/network stop
macchanger --mac=00:20:ed:6e:b4:34 eth0
/etc/rc.d/network start
An everything goes fine(the mac changes and i have internet)
But when i restart, the mac isstill the old one, and I have to change it again. how to solve this? Maybe add this commands somewhere so arch will execute them every time? But where?
Thank you.
Offline
/etc/rc.local is exactly for something like this.
1000
Offline
Hello gunshot!
But when i restart, the mac isstill the old one, and I have to change it again. how to solve this? Maybe add this commands somewhere so arch will execute them every time? But where?
You may want to write your own 'daemon', which will handle macchange on boot. As an example you may use the /etc/rc.d/alsa daemon, which does quite similar things to what you want to do...
If you're not experienced in shell scripts then let me know.. If I'll have time, I write it for you
-miky
What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...
... and who is general Failure and why is he reading my harddisk?
Offline
Thank you for your help. Your answers were useful and I'll see what I can do myself. If I come to a solution or became stuck, I'll write.
Thank you.
Offline
i've done a new file:
/etc/rc.d/mac_eth0
so when i write (as root):
/etc/rc.d/mac_eth0 start
if sets everything fine
i don't know if this is a right way to do it.
so, if there's a way to start this file (as root) every time the systems starts and you know it, please tell me.
if this shouldn't or can't be done that way, please give me some directions how to do it.
thank you.
Offline
That is indeed the right way.
To start the daemon every time as root on a system start edit /etc/rc.conf:
DAEMONS=(... mac_eth0 network ...)
I guess you have to place the mac_eth0 daemon in front of the network daemon!
Offline
i don't know if this is a right way to do it.
so, if there's a way to start this file (as root) every time the systems starts and you know it, please tell me.if this shouldn't or can't be done that way, please give me some directions how to do it.
That is imho the best way to do such things. All you need to do is, as Bob Day wrote, add your mac_eth0 to DAEMONS array in /etc/rc.conf.
It will cause the mac_eth0 script to be called on system startup as root with 'start' parameter and with 'stop' parameter on system shutdown.
It has to be written before 'network' daemon in order to set MAC before network is fired up...
Just out of curiosity, could you paste that mac_eth0 script here? ;-)
-miky
What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...
... and who is general Failure and why is he reading my harddisk?
Offline
The problem is solved.
Thanks to mr.MikyMaus and Bob Day.
I had 2 errors:
1st. I tried to start the daemont last in rc.conf and to restart the network and this makes no sence
2nd. A minor error in the script
After fixing them everything works PERFECT
Here is the code (although I doubt if it would be useful for someone):
/etc/rc.conf
#...
DAEMONS=(syslog-ng !hotplug mac_eth0 network sshd netfs crond xinetd httpd)
#...
/etc/rc.d/mac_eth0
#!/bin/bash
#This file changes the MAC address of eth0
start()
{
echo "Changing MAC..."
/usr/local/bin/macchanger --mac=00:20:ed:6e:b4:34 eth0
}
stop()
{
echo "Macchanger stops"
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo "Use $0 [start] to change the MAC!"
;;
esac
exit 0
Offline
I'm glad it works to your satisfaction:)
Here is the code (although I doubt if it would be useful for someone):
I would not be so sure about this. I myself have exactly the same problem with my network card. I have to rewrite MAC everytime prior connecting to network.
The only difference is that I cannot afford such comfort of changing mac on boot because MAC, in my case, has to be rewritten prior to connecting cable to card.
So I have a script which does both MAC change and network start and I run it manually.
But not everyone has to have his MAC rewritten prior to connection. If you'd like to practise some shell coding, you may alter your script to be more portable, like adding some configuration files to /etc/conf.d/ and make it ArchLinux-compilant. I can help with that, if you wish.
And you can be sure you'll make at least a few archers happy, including you ;-)
-miky
What happened to Arch's KISS? systemd sure is stupid but I must have missed the simple part ...
... and who is general Failure and why is he reading my harddisk?
Offline
That's a good idea. That was my first step (maybe second) in bash script writting, so need practice.
what needs to be done is
1. storing the old MAC and an option to restore it (./mac_eth0 stop)
2. dispalying information about the original and the current MAC (./mac_eth0 info)
3. configuration - network adapter and new MAC
4. other stuff, that I don't know
When I have time and access to my arch machine, I'll be glad to do it (With your help if necessary)
Offline