Koozali.org: home of the SME Server

Help ! Clone Mac Address on WAN Interface

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #15 on: April 06, 2009, 08:53:42 PM »
This way is not concluant...

I'm sorry, but "concluant" is not a word in English, and I do not know what you are trying to tell us. I'm also not sure what MAC address you want to "clone" to your WAN interface. Is it the MAC of a NIC? If so, can you not just use that NIC in your SME server?

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Re: Help ! Clone Mac Address on WAN Interface
« Reply #16 on: April 06, 2009, 10:42:11 PM »
this solution is not functional, sorry I speak usually french...

It's the mac Address that I want to clone. This Mac address is from a HOME cable/router, and I can't use his Nic.

Or I have to desolder and solder it on a PCI board  and write some drivers :???:

Thanks a Lot

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 #17 on: April 06, 2009, 11:03:11 PM »
It's the mac Address that I want to clone. This Mac address is from a HOME cable/router, and I can't use his Nic.

OK. And do you know whether you need to use the MAC address for Layer 2 ethernet addressing, or just as the client identifier for DHCP, or do you need to do both?

I also do not understand the narrative of your testing, which you say "is not functional". You have shown some DHCP leases but I do not know what you hoped or expected to see, or how what you did see is different from your expectations.

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #18 on: April 06, 2009, 11:08:58 PM »
if I do (with or without the custom template)

Code: [Select]
#ifdown eth1
#ifup eth1

after that the network is unreachable  :???:

You should not use ifdown and ifup with eth1. In SME server, the eth1 interface is controlled by /service/wan/run (which will chain to /var/service/wan/run.dhclient when the dhcp client is enabled).

You will need to use a custom template to modify /var/service/wan/dhclient.config if you wish to use a different MAC with eth1, and modify /var/lib/dhcp/dhclient-eth1.conf if you wish to use a different client identifier.

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Re: Help ! Clone Mac Address on WAN Interface
« Reply #19 on: April 07, 2009, 05:13:15 PM »
Quote
I also do not understand the narrative of your testing, which you say "is not functional". You have shown some DHCP leases but I do not know what you hoped or expected to see, or how what you did see is different from your expectations.

In fact it is the answer to the solution you have proposed.

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.

00:16:17:b2:bd:58 is the Mac Address that the DHCP server should be show to give the proper lease

if I write send dhcp-client-identifier 00:16:17:b2:bd:58; in  /var/lib/dhcp/dhclient-eth1.conf (SME2)

SME1 as DHCP-Server (beckysrv001) <---> SME2 as DHCP-Client (mbsrv001)

Code: [Select]
beckysrv001 /var/lib/dhcp/dhcpd.leases (SME1)
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";

if I write send dhcp-client-identifier "00:16:17:b2:bd:58"; in  /var/lib/dhcp/dhclient-eth1.conf (SME2)

Code: [Select]
beckysrv001 /var/lib/dhcp/dhcpd.leases (SME1)
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";

You can see that the real physical HwAddress (00:c0:df:10:60:54) is used and not wich I want to clone 00:16:17:b2:bd:58.

why I say the solution is not functional

In fact I want my network card appears as 00:16:17:b2:bd:58 and not as 00:c0:df:10:60:54 his real HwAddr.

This is what we call the Mac Address Cloning. Many Windows Network Drivers or Home Router can do that.

Olivier Beeckmans


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

Online Stefano

  • *
  • 10,894
  • +3/-0
Re: Help ! Clone Mac Address on WAN Interface
« Reply #20 on: April 07, 2009, 05:24:32 PM »
beckynet:

as Chalie said:
Quote
You will need to use a custom template to modify /var/service/wan/dhclient.config if you wish to use a different MAC with eth1, and modify /var/lib/dhcp/dhclient-eth1.conf if you wish to use a different client identifier.
you have to modify other templates..

Ciao
Stefano

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Re: Help ! Clone Mac Address on WAN Interface
« Reply #21 on: April 08, 2009, 10:45:53 PM »
I've try to edit directly the file /var/service/wan/dhclient.config

as this :

Code: [Select]
/sbin/modprobe eth0
/sbin/modprobe eth1
/sbin/ifconfig eth1 up mtu 1500 hw ether 00:16:17:b2:bd:58

interface=eth1

I've reboot the server and nothing was changed

eth1      Link encap:Ethernet  HWaddr 00:04:75:BF:6C:EB
          inet addr:10.0.0.31  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1662 errors:0 dropped:0 overruns:1 frame:0
          TX packets:1093 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:351095 (342.8 KiB)  TX bytes:861371 (841.1 KiB)
          Interrupt:185 Base address:0xe880

The real physical address is used no cloning or spoofing

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 #22 on: April 09, 2009, 12:06:32 AM »
Try:

/sbin/ip link set dev eth1 address 00:16:17:b2:bd:58

Offline beckynet

  • *
  • 107
  • +0/-0
    • http://www.beckynet.be
Re: Help ! Clone Mac Address on WAN Interface
« Reply #23 on: April 09, 2009, 05:29:06 PM »
Hello CharlieBrady,

I've try

Code: [Select]
/sbin/ip link set dev eth1 address 00:16:17:b2:bd:58
signal-event reboot

No change Physical address is used

Thanks for your respons

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 #24 on: April 09, 2009, 06:37:30 PM »
No change

Well, that's hardly surprising - you changed the MAC on eth1 and then rebooted - losing your change. Put the "ip link ..." command in /var/service/wan/dhclient.config (via a custom template).

Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
Re: Help ! Clone Mac Address on WAN Interface
« Reply #25 on: April 10, 2009, 06:18:50 AM »
I've try to edit directly the file /var/service/wan/dhclient.config

--SNIP--

The real physical address is used no cloning or spoofing

Olivier Beeckmans

Try this...

Code: [Select]
cd /etc/e-smith/templates/var/service/wan/dhclient.config/
Code: [Select]
mkdir -p /etc/e-smith/templates-custom/var/service/wan/dhclient.config
Code: [Select]
cp device /etc/e-smith/templates-custom/var/service/wan/dhclient.config/device
Code: [Select]
cd /etc/e-smith/templates-custom/var/service/wan/dhclient.config
Code: [Select]
vi device
Edit the file as such. Your MTU may remain at 1500.
Save the file.

Code: [Select]
{
    my $device = $ExternalInterface{Name} || "eth1";
    $OUT .= "/sbin/modprobe eth0\n";
    $OUT .= "/sbin/modprobe eth1\n" if $device eq "eth1";
    if ($device eq "eth0.4094")
    {
        $OUT .=
            "/sbin/modprobe 8021q\n" .
            "/sbin/vconfig add eth0 4094\n";
    }
    $OUT .= "/sbin/ifconfig $device down\n";
    $OUT .= "/sbin/ifconfig $device mtu 576 hw ether 00:16:17:b2:bd:58\n";
    $OUT .= "/sbin/ifconfig $device up\n\n";
    $OUT .= "interface=$device\n";
}

Code: [Select]
expand-template /var/service/wan/dhclient.config
Code: [Select]
signal-event reboot
Confirm with ifconfig eth1 and route -n

If you have no IP or default gateway,

dhclient eth1 and kill the PID of the already running client.

Recheck, Reboot, Recheck.

What I now see....

[root@sme7vm dhclient.config]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:16:17:B2:BD:58 
          inet addr:211.123.123.123  Bcast:211.123.123.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:576  Metric:1
          RX packets:2706 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2406 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:857179 (837.0 KiB)  TX bytes:402247 (392.8 KiB)
          Interrupt:177 Base address:0x2000


Yes, my eth0 and eth1 are swapped.

Regards,
William

IF I give advise.. It's only if it was me....