PDA

View Full Version : How to change network MAC address in Duo?



parkher
13-08-10, 23:30
I am using PLi

I tried to run the following script (the MAC address in this post is a fake):

ifconfig eth0 down
ifconfig eth0 hw ether 00:01:02:3A:4B:5F
ifconfig eth0 up

I got:

'fconfig: bad address 'down
ifconfig: invalid hw-addr 00:01:02:3A:4B:5F
'fconfig: bad address 'up

What am I doing wrong?

Perhaps there is another image with network setup dialog which allows to change the MAC address?
Or a plugin?

Is setting of the hardware address even supported by the device driver in Duo?


BTW: here is what I get with
ifconfig -a (again the MAC address is a fake):


root@vuduo /etc # ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:1F:BD:02:8E:63
inet addr:192.168.1.64 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:939 errors:0 dropped:0 overruns:0 frame:0
TX packets:2615 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:80772 (78.8 KiB) TX bytes:258737 (252.6 KiB)
Interrupt:16

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:54 errors:0 dropped:0 overruns:0 frame:0
TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4284 (4.1 KiB) TX bytes:4284 (4.1 KiB)

pooface
14-08-10, 06:14
Not sure whether it was just a typo on here, or whether in the script, but you have 'fconfig rather than ifconfig in the error message, which would make me think the command issue was 'fconfig... Might be that the box does not support it, but check your script...

Why'd you need to change ip anyway?

parkher
14-08-10, 22:57
Sorry, it was all my fault.
The shebang line was somehow missing from the beginning of my script, like this:
#!/bin/sh

After fixing this, the new MAC address was set successfully.

basilyoung
14-08-10, 23:17
as asked, why change the MAC addy??

also just noticed your signiture, thats one hell of a dish set up

baz

parkher
15-08-10, 00:12
Mostly for emergencies and to have more flexibility.
Currently I have 3 separate ISPs simultaneously (and three network adapters in my main PC), two of them allow only one fixed MAC address, registered with them, (one each)
the 3rd one does not require, and as it happens only this one currently goes through a router.
So until I add routers for the other two, if the one with the router goes down, I could connect Vu+ through one of those, etc.

Yes, a lot of satellites. Way too many, probably. And neither Duo nor Octagon are particularly suitable for hunting feeds.
I mostly watch 28E and also 36E - I am a tennis fan, and the russian satellite has plenty of tennis, a special tennis channel and often 2-3 others, and even now (exactly at this moment), it is the only place I can find WTA from Cincinnati, the 2nd semi live (ntv+ sport-online channel), while ATP is everywhere, including Sky UK.

grtmoby
15-08-10, 00:19
parkher the WTA is FTA on Dubai sports, Nilesat 7W

parkher
15-08-10, 01:49
Looked at its diagram - it is visible only in North Africa and in the Middle East.
Not at 55 North in Europe - signal strength is 0

grtmoby
15-08-10, 01:56
u mean by the russian satellite the one at 36E :confused:

parkher
15-08-10, 03:29
Yes, 36E circular.
It has mostly russian and ukrainian channels.
They show grand slams on two channels + HD, sometimes HD independently third (except RG - a different russian channel shows it, but still on 36E - there is a war about broadcasting rights between them).
Even now, Toronto and Cincinnati, they show them on two simultaneously, and some repeats on the third.
So more choice. Now, with US Open approaching, it may be very important - I can see only half of Sky Sports Active, one transponder is out of reach, and during USO sometimes they show tennis on them, sometimes - cricket, feels like deliberately.
Driving me up the wall. But even then I am thinking about MAC address - to stay on topic here:)

mitra-sara
07-09-10, 01:27
I am using the latest VTI image v2.0 on OE1.6. How can I change my mac address? The MAC address you have changed to it is always written on the flash memory or it lost when you switch off the receiver(I mean plug the power out) ? I appreciate to help me to change my MAC addrees.

parkher
08-09-10, 07:48
I don't think that there is any difference which image you are using.
To change your mac address you need to run a script. It is not possible to change mac address manually via telnet, because, in order to change it, the interface cannot be in use at that time.
So first you need to switch it off, but when you do that, you no longer can enter further commands.
In theory the command that is changing the mac address is supposed to switch the interface off if it is in use (perhaps?), but it does not work that way on Duo.
So using a script solves the problem.
For example:

you may create a file, lets say, with a name change_mac_address
and inside that file you may have the following lines:

#!/bin/sh
ifconfig eth0 down
ifconfig eth0 hw ether 00:03:55:6B:C8:2F
ifconfig eth0 up

where 00:03:55:6B:C8:2F is the new mac address you want to change to.
Put this script to, let's say /etc
Now, connect via telnet,
then
cd /etc
chmod +x change_mac_address
./change_mac_address

That's it.
chmod is needed only once, it gives the permission to execute that file
you can check its effect by (do it before and after):
ls -l change_mac_address

./change_mac_address runs the script.

After you execute that command, your telnet connection will be lost.
And any connection to the box.
The line:
ifconfig eth0 up
switches the adapter on again.
But it seems that it is not enough to restore the connection,
I still need to go to Menu/Settings/System/Network/Restart network with the remote.
So my script can be improved.
However, it works.
When you restart the network, you may connect via telnet again and do this:

ifconfig -a

You will see that the new mac addressed is now used for the interface.

After rebooting, the old mac address returns.
To make this new mac address permanent, you need to add either those script lines directly, or the line to execute it into another script which is run when rebooting,
so that it is done each time you reboot.
Preferably, so you do not need to restart the network manually.
Perhaps it can be done at a stage when the interface down command is not yet needed
I did not try it yet, but it seems that inittab may be a good place, or one of the scripts that are invoked from inside inittab.

Perhaps somebody can tell exactly where and how is the best place to run this script?

parkher
08-09-10, 08:24
Anyway, before experimenting with adding this script to the rebooting sequence, it is a good idea to make the backup of your image/settings. (unless you know exactly where and what to add).
And do not leave the backup on the internal drive of duo, move it to your PC or directly to a usb stick.
In theory, it may go wrong in two ways, if you put wrong lines to the wrong place:
1. no connection and restarting network does not work, so no way to reestablish connection, and without it, no way to remove those lines from the script, and after rebooting, again the same.
2. the rebooting script hangs and does not finish and therefore perhaps even worse than 1.

parkher
09-09-10, 11:07
There might be much simpler solutions, here is a direction I want to explore:

/etc/network/interfaces

there I see something like this:

auto eth0
iface eth0 inet static
address 192.168.1.64
netmask 255.255.255.0
gateway 192.168.1.254

Now, it seems to me that it could be enough to add
another line:

hwaddress ether 00:02:56:3D:B8:1F

so that we have:

auto eth0
iface eth0 inet static
address 192.168.1.64
netmask 255.255.255.0
gateway 192.168.1.254
hwaddress ether 00:02:56:3D:B8:1F

This could work without any other script, and would be a permanent solution, will not be changed by rebooting.
Notice: NOT TESTED by me YET


BTW, about the privious (tested and working) solution with the script.
In order to eliminate the necessity to restart the network with remote, it might be enough to add one more ifconfig line to the script after up - to set the ip address.

parkher
09-09-10, 12:44
Here is new and tested solution, works fine, is permanent, the new mac address is retained after reboot as well:

add a special script file to
/etc/network/if-pre-up.d/

here is the contents of my script file "change-mac-address":

--------------------------- this line is not included inside the file, just indicates where the contents of the file begins ---------------------
#!/bin/sh

if [ "$IFACE" = "eth0" ]; then
/sbin/ifconfig eth0 hw ether 00:03:45:67:89:AF
fi
exit 0
------------------ likewise, indicates the end of the file, not inside the file -------------------------

Do not forget to make this file executable
chmod a+x change-mac-address

The new mac address (in this example: 00:03:45:67:89:AF) will take effect after rebooting, and subsequent rebooting or network restarting with remote will not revert the mac address back to the original one.
IMPORTANT: the file name with this script CANNOT have extension .sh, i.e,
if the file is named change-mac-address.sh - then it will not work!!!
All the files in that directory are run as scripts at a proper time if they have execution rights, as long as their names do not end with .sh !!!