Koozali.org: home of the SME Server

Help ! Clone Mac Address on WAN Interface

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Help ! Clone Mac Address on WAN Interface
« on: March 27, 2009, 08:43:03 PM »
I've find this topic, but the SME structure have changed.

http://forums.contribs.org/index.php/topic,16551.msg

I use a cable modem, and my provider provide address for a specified Mac Address.

How can I clone mine on the Wan Interface

Thanks a Lot

Olivier Beeckmans
----------------------------------------------------
Beeckmans Olivier
Belgian Army ICT Technician
I discovered E-Smith with version 4.12
----------------------------------------------------

Offline maounique

  • 4
  • +0/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #1 on: March 27, 2009, 09:18:27 PM »
I presume is it the standard eth1 for external connection and you do not have it swapped:

ifdown eth1
ifconfig eth1 hw ether XX:XX:XX:XX:XX:XX
ifup eth1
ifconfig eth1

Do it first by hand to test if it works and you can connect, then make a custom template as per the example in the thread you linked. That should be for the /etc/e-smith/templates/custom/etc/rc.d/rc.local
Of course, you may make this modification elsewhere, that is how i do my stuff so I can have it all in the same place since it is very hard to remember what changes i made in which server since I have so many to look after.
Last line can be omitted in the template, it is just to check if the address changed.
Quick and dirty, but simple and should work.
M
« Last Edit: March 27, 2009, 09:23:53 PM by maounique »

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #2 on: March 27, 2009, 09:24:50 PM »
hi

try this:

1) create /etc/e-smith/templates-custom/etc/sysconfig/network-scripts/ifcfg-ethX directory
Code: [Select]
mkdir -p /etc/e-smith/templates-custom/etc/sysconfig/network-scripts/ifcfg-ethX

2) copy the right fragment into it
Code: [Select]
cp /etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/90otherparams /etc/e-smith/templates-custom/etc/sysconfig/network-scripts/ifcfg-ethX/
NOTE: it's one line

3) edit the fragment
Code: [Select]
pico /etc/e-smith/templates-custom/etc/sysconfig/network-scripts/ifcfg-ethX/90otherparams

and modify in this way:

Code: [Select]
if ($is_external)
    {
   # We are now running a supervised dhcpcd - setting the BOOTPROTO to "none"
   # allows the supervised dhcpcd to do the work without fighting with ifup
   return "BOOTPROTO=none" if ($ExternalDHCP eq "on");

   my ($network, $broadcast) = esmith::util::computeNetworkAndBroadcast ($ExternalIP, $ExternalNetmask);

   return "BOOTPROTO=none " .
        "IPADDR=$ExternalIP " .
        "MACADDR=AA:BB:CC:DD:EE:FF " .
        "NETMASK=$ExternalNetmask " .
        "NETWORK=$network " .
        "BROADCAST=$broadcast";
    }

DO NOT TOUCH the rest of file

save and close it with Ctrl-X

now I would do
Code: [Select]
signal-event post-upgrade
signal-event reboot

should work :)

HTH
Ciao
Stefano
« Last Edit: March 27, 2009, 09:26:33 PM by Stefano a.k.a. nenonano »

Offline maounique

  • 4
  • +0/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #3 on: March 27, 2009, 09:37:24 PM »
By the book !
:)
M

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Re: Help ! Clone Mac Address on WAN Interface
« Reply #4 on: March 27, 2009, 10:49:38 PM »
Thanks for this quick and complete respons.

Olivier Beeckmans
----------------------------------------------------
Beeckmans Olivier
Belgian Army ICT Technician
I discovered E-Smith with version 4.12
----------------------------------------------------

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Re: Help ! Clone Mac Address on WAN Interface
« Reply #5 on: April 03, 2009, 03:25:51 PM »
Hi Stefano,

I've try your solution that don't run.

I've selected for my external Address (eth1 is the external Interface) :
Use DHCP (send ethernet address as client identifier)

But when the External DHCP Server provide one IP address, the MAC ADDRESS send is the real physical address not the address provide in the script.

content of the ifcfg-eth1 after creation of custom template and signal-event post-upgrade
I don't see any MACADDRESS Param
Code: [Select]
TYPE=Ethernet
DEVICE=eth1


USERCTL=no
ONBOOT=no
PEERDNS=no

IPV6INIT=no

IPADDR=1.1.1.1

I've try that manually edit it
Code: [Select]
TYPE=Ethernet
DEVICE=eth1


USERCTL=no
ONBOOT=no
PEERDNS=no

IPV6INIT=no

IPADDR=1.1.1.1
MCADDRESS=AA:BB:CC:DD:EE:FF

The result is the same

if I do (with or without the custom template)

Code: [Select]
#ifdown eth1
#ifup eth1

after that the network is unreachable  :???:

What must I do ? Must I edit the dhcp client of SME ? where is it ?

Thanks a lot

Olivier Beeckmans
----------------------------------------------------
Beeckmans Olivier
Belgian Army ICT Technician
I discovered E-Smith with version 4.12
----------------------------------------------------

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #6 on: April 03, 2009, 03:31:07 PM »
ok.. try this:

Code: [Select]
if ($is_external)
    {
   # We are now running a supervised dhcpcd - setting the BOOTPROTO to "none"
   # allows the supervised dhcpcd to do the work without fighting with ifup
   if ($ExternalDHCP eq "on") {
         return "BOOTPROTO=none" .
          "MACADDR=AA:BB:CC:DD:EE:FF ";
   }
   my ($network, $broadcast) = esmith::util::computeNetworkAndBroadcast ($ExternalIP, $ExternalNetmask);

   return "BOOTPROTO=none " .
        "IPADDR=$ExternalIP " .
        "NETMASK=$ExternalNetmask " .
        "NETWORK=$network " .
        "BROADCAST=$broadcast";
    }


and let us know..

thank you
ciao
Stefano

Offline uniqsys

  • *
  • 133
  • +0/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #7 on: April 03, 2009, 03:55:52 PM »
Ciao Stefano,

Once you get this working, I would like to create a How To on this.

Grazie tante, va bene.
...

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Re: Help ! Clone Mac Address on WAN Interface
« Reply #8 on: April 03, 2009, 04:03:53 PM »
That don't run  :sad:

The physical Mac Address is used.

Thanks for your quick respons

Olivier Beeckmans

----------------------------------------------------
Beeckmans Olivier
Belgian Army ICT Technician
I discovered E-Smith with version 4.12
----------------------------------------------------

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Re: Help ! Clone Mac Address on WAN Interface
« Reply #9 on: April 04, 2009, 08:11:36 PM »
Hey, SME Guru !

I really need a solution to modify the Mac Address send by the DHCP Client of my WAN Interface (eth1).

My Internet Provider don't allow traffic on other Mac Address

Thanks a Lot

Olivier Beeckmans
----------------------------------------------------
Beeckmans Olivier
Belgian Army ICT Technician
I discovered E-Smith with version 4.12
----------------------------------------------------

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #10 on: April 04, 2009, 09:06:34 PM »
Olivier..

ask your ISP to modify its setting to the new MAC.. it seems to me the only alternative.

then create a NFR in bugzilla for such a function

Thank you
ciao
Stefano

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #11 on: April 04, 2009, 09:17:00 PM »
My Internet Provider don't allow traffic on other Mac Address

Then they are not providing you with what you are paying them for. Get them to change their MAC assignment, or find another ISP.

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Re: Help ! Clone Mac Address on WAN Interface
« Reply #12 on: April 04, 2009, 09:56:41 PM »
The company changed ownership. If I change something I have to do a less advantageous contract.

I have a upload bandwidth up to 2 Mb, If I must resign a new contract I am down to 768Kb. And I pay 3 times more expensive for that.
No other provider can provide me with this bandwidth at the current price.

That is why I really need.

What grieves me most is that Windows can do it easily. And that under SME seems to be impossible.

Olivier Beeckmans
----------------------------------------------------
Beeckmans Olivier
Belgian Army ICT Technician
I discovered E-Smith with version 4.12
----------------------------------------------------

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #13 on: April 05, 2009, 06:10:21 AM »
What grieves me most is that Windows can do it easily. And that under SME seems to be impossible.

It's possible, but you'll need to work out how to do it. Perhaps adding something like:

send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;

to /var/lib/dhcp/dhclient-eth1.conf will do it.

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Re: Help ! Clone Mac Address on WAN Interface
« Reply #14 on: April 05, 2009, 10:45:41 AM »
Hello Charlie Brady,

I've try with : (For the Test I use a SME Server as DHCP server, and he must give IP 10.0.0.31 to Mac Address 00:16:17:b2:bd:58)

send dhcp-client-identifier "mbsrv001"; Original

lease 10.0.0.180 {
  starts 0 2009/04/05 08:08:23;
  ends 1 2009/04/06 08:08:23;
  binding state active;
  next binding state free;
  hardware ethernet 00:c0:df:10:60:54;
  uid "mbsrv001";
  client-hostname "mbsrv001";


send dhcp-client-identifier 00:16:17:b2:bd:58; Mac Address I want to send to request a DHCP lease

lease 10.0.0.193 {
  starts 0 2009/04/05 07:41:14;
  ends 1 2009/04/06 07:41:14;
  binding state active;
  next binding state free;
  hardware ethernet 00:c0:df:10:60:54;
  uid "\000\026\027\262\275X";
  client-hostname "mbsrv001";


send dhcp-client-identifier "00:16:17:b2:bd:58"; Mac Address I want to send to request a DHCP lease

lease 10.0.0.174 {
  starts 0 2009/04/05 07:34:18;
  ends 1 2009/04/06 07:34:18;
  tstp 1 2009/04/06 07:34:18;
  binding state active;
  next binding state free;
  hardware ethernet 00:c0:df:10:60:54;
  uid "00:16:17:b2:bd:58";
  client-hostname "mbsrv001";

This way is not concluant...

Thanks for your respons

Olivier Beeckmans
----------------------------------------------------
Beeckmans Olivier
Belgian Army ICT Technician
I discovered E-Smith with version 4.12
----------------------------------------------------