Koozali.org: home of the SME Server

Spoof MAC Address?

len_chan

Spoof MAC Address?
« on: July 26, 2004, 07:28:40 PM »
Hi all,

I'm doing a hardware upgrade (and SME upgrade to 6.x).  My ISP gives out IP addresses via DHCP using the MAC.

I'd like to keep my current IP address after the upgrade, because I've got a domain or two pointing at it.

So, how do I go about instructing this guy to use a specific MAC address for the external NIC?  

Thanks!

Leonard

Offline steve

  • 4
  • +0/-0
Spoof MAC Address?
« Reply #1 on: July 27, 2004, 09:40:06 PM »
I think I understand what you are doing.

Each MAC address is unique and assinged to an individual Network Interface Card (NIC).

So, the easiest way to achieve what you need is to keep the NIC that is currently in your server pre upgrade.

If you infact go with a new NIC you will then contact your ISP and provide them the new MAC address which they will associate with your static IP.

Either way there is nothing you need to do to the server itself.

Steve
Steve Lewis
Little Rock, Arkansas, U.S.A.............

SSBN

Spoof MAC Address?
« Reply #2 on: July 28, 2004, 03:50:31 AM »
Steve is correct you shouldn't have to spoof it. My ISP works the same way. But they can change you mac in their DHCP to give the same IP to you new MAC. But if you want to play here is how to spoof a MAC

ifconfig [interface name] hw ether [new MAC address]

For example, the interface name is "eth0" and the new MAC address is "01:02:03:04:05:06":
[root]# ifconfig eth0 hw ether 01:02:03:04:05:06

len_chan

Spoof MAC Address?
« Reply #3 on: July 28, 2004, 06:27:25 AM »
Thanks for the responses. No, I didn't really need to spoof it, but I was getting used to my IP address - it's a basic residential broadband account, so I have no particular privileges to the IP address.

I did try the ifconfig line, but I didn't know where to put that in the startup scripts.  After some digging elsewhere, I ended up making a copy of this file in the custom template tree:

   /etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-eth1

and adding a "MACADDR =xx:xx:yy:zz" line to it. It seems to remember this setting over reboots, and hopefully after config changes...

FWIW, I couldn't migrate the NIC, it was ISA (!) and one of the reasons for the upgrade.  :-D

Offline dmac

  • ****
  • 143
  • +0/-0
    • http://www.rylar.ca
Spoof MAC Address?
« Reply #4 on: July 28, 2004, 08:40:48 PM »
Why not set yourself up with a FREE Zoneedit account?
"In a world without Fences, why do we need Gates and Windows"

SSBN

Spoof MAC Address?
« Reply #5 on: August 03, 2004, 04:59:54 PM »
len_chan could you post your ifcfg-eth1 file. I cant seem to get it to add the mac. Here is what I have.

#------------------------------------------------------------
# DO NOT MODIFY THIS FILE! It is updated automatically by the
# e-smith server and gateway software. Instead, modify the source
# template in the /etc/e-smith/templates-custom directory. For more
# information, see http://www.e-smith.org.
#
# copyright (C) 1999-2001 e-smith, inc.
#------------------------------------------------------------

DEVICE=eth1
USERCTL=no
ONBOOT=yes
{
    #--------------------------------------------------
    # This template will only be instantiated if dedicated
    # connection in server-and-gateway mode.
    #--------------------------------------------------

    if (($SystemMode =~ /servergateway/) && ($AccessType eq 'dedicated') && $EthernetAssign && ($EthernetAssign eq 'swapped'))
    {
   # eth1 is inner interface (swapped)

   my ($network, $broadcast) = esmith::util::computeNetworkAndBroadcast ($LocalIP, $LocalNetmask);

   "MACADDR=00:05:5D:28:99:16" .
   "BOOTPROTO=none\n" .
   "IPADDR=$LocalIP\n" .
   "NETMASK=$LocalNetmask\n" .
   "NETWORK=$network\n" .
   "BROADCAST=$broadcast";
    }
    else
    {
   # eth1 is outer interface (normal)

   my $bootproto = ($ExternalDHCP eq "on") ? "dhcp" : "none";
   my ($network, $broadcast) = esmith::util::computeNetworkAndBroadcast ($ExternalIP, $ExternalNetmask);

        "BOOTPROTO=$bootproto\n" .
        "IPADDR=$ExternalIP\n" .
        "NETMASK=$ExternalNetmask\n" .
        "NETWORK=$network\n" .
        "BROADCAST=$broadcast";
    }
}

len_chan

Spoof MAC Address?
« Reply #6 on: November 22, 2004, 11:13:22 PM »
Hi SSBN,

Sorry for the late reply (like 4 months!).  I don't check in to contribs.org often enough, it seems.  Anyway, for the record, in case others need this info...

I just checked my server, and apparently I lied.  The correct file to change is:

/etc/e-smith/templates-custom/etc/sysconfig/network-scripts/ifcfg-ethX/90otherparams

I believe the only change I made, was the addition of the MACADDR line.  Note: you also have to expand the template once you add the line - you'll have to search this site to figure out how to do that, I can never quite remember how that works.  
That file now looks like this:


Code: [Select]

{
    use esmith::util;

    return "" if ($ifup_this_device eq "no");

    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\n" .
        "IPADDR=$ExternalIP\n" .
        "NETMASK=$ExternalNetmask\n" .
        "NETWORK=$network\n" .
        "BROADCAST=$broadcast\n" .
        "MACADDR=00:20:AF:E4:D7:89";
    }

    my ($network, $broadcast) = esmith::util::computeNetworkAndBroadcast ($LocalIP, $LocalNetmask);

    return "BOOTPROTO=none\n" .
    "IPADDR=$LocalIP\n" .
    "NETMASK=$LocalNetmask\n" .
    "NETWORK=$network\n" .
    "BROADCAST=$broadcast";
}