How to change en0 MAC address ?

How to change en0 MAC address ?

/how to do it from command line
and in c/c++ program ?

Q <no@spam.pl> wrote:

How to change en0 MAC address ?

/how to do it from command line

From command line:

ifconfig en0 10.0.0.1

and in c/c++ program ?

system(“ifconfig en0 10.0.0.1”);

is the easiest.

spawnl(P_WAIT, “ifconfig”, “ifconfig”, “en0”, “10.0.0.1”, NULL );

is a it more efficient.

It can probably be done through a set of other operations, since
ifconfig is implemented in C, but I don’t know what they are.

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com

David Gibbs <dagibbs@qnx.com> wrote:

Q <> no@spam.pl> > wrote:
How to change en0 MAC address ?

/how to do it from command line

From command line:

ifconfig en0 10.0.0.1

He asked about MAC address, not IP address.

On Mon, Aug 28, 2006 at 08:27:03AM +0200, Q wrote:

How to change en0 MAC address ?

/how to do it from command line
and in c/c++ program ?

I believe you can only do it from the command line when you mount/load
the driver. The devn drivers have a mac=xxxxxxxxxxxx option.

Once it’s running there is no changing the MAC address (apart from
un-mounting the driver and then remounting with a different MAC).


Regards,
Gilles

Once it’s running there is no changing the MAC address (apart from
un-mounting the driver and then remounting with a different MAC).

I anticipate that :frowning:

I write script to change MAC
and its a pity that there is not other way to do it :frowning:.

chmac 0 001122334455

chmac {
umount /dev/io-net/en$1
mount -v -Tio-net -v -o mac=$2,pci=$1 /lib/dll/devn-pcnet.so
}

ifconfig en0 10.0.0.1

I didn’t ask for that…

system(“ifconfig en0 10.0.0.1”);
spawnl(P_WAIT, “ifconfig”, “ifconfig”, “en0”, “10.0.0.1”, NULL );

…but this will be useful for me, in future :slight_smile:

“Q” <no@spam.pl> wrote in message news:ed3anq$bf6$1@inn.qnx.com

Once it’s running there is no changing the MAC address (apart from
un-mounting the driver and then remounting with a different MAC).

I anticipate that > :frowning:

I write script to change MAC
and its a pity that there is not other way to do it > :frowning:> .

How simpler could it be? Even if you can skip the unmout process,
internally everything has to go through some reinitialisation. It’s easy to
imagine that changing a MAC address in the middle of a network transaction
can be tricky to handle…

chmac 0 001122334455

chmac {
umount /dev/io-net/en$1
mount -v -Tio-net -v -o mac=$2,pci=$1 /lib/dll/devn-pcnet.so
}

Frank Liu <fliu@usdjmp1.eng.vodafone-us.com> wrote:

David Gibbs <> dagibbs@qnx.com> > wrote:
Q <> no@spam.pl> > wrote:
How to change en0 MAC address ?

/how to do it from command line

From command line:

ifconfig en0 10.0.0.1


He asked about MAC address, not IP address.

Oh, right. Oops.

Um… generally that comes from the hardware, which has a little
chip on it that gives the MAC address.

Some ethernet chips have the ability to “tell” them a MAC address
when they are initialized, though not all have that ability.

For those drivers that have this capability, it will be a “mac=XXXXXXXXXXX”
when the driver is launched, either from the io-net command line, or
when the mount command is issued to load the driver.

I know of no way to change it after en0 exists, that is after the driver
has initialized. (Well, kill off io-net, relaunch with different driver
options – but no re-config method.)

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com