Hello. I'm using this firmware for the first time and i've encountered a problem. I want to clone mac from pc to router to be able to switch the cable (my provider binds to mac). So i'm going "Network->Interfaces->Wan Edit -> Advanced Settings -> Override MAC address" and enter mac of pc. And it works partly: for provider it's ok, i have connection on my laptop(via lan) and mobile (via wi-fi), but haven't on pc (via second lan). Without clonning all three device have connection. Suspect that i need to do something else to have connection on the device with the cloned mac, but don't understand what exactly. Before that, I used the stock firmware and there were enough of these changes. Tell me what I'm doing wrong, please.
MAC adresses must be unique in your LAN, if you clone your computer's MAC address on your router, you need to give your computer a new/ different one.
Really? In a poor basic firmware this works, but in a cool and modern custom firmware doesn't?
Under Network->Interfaces click 'Edit' on WAN. Click on 'Advanced Settings'. Change the 'Client ID to send when requesting DHCP' and 'Vendor Class to send when requesting DHCP' values to the MAC address you want to use when 'cloning'. It will pretty much say to your ISP "This is my WAN MAC address" when requesting a WAN IP Address from your ISP. Do not change the 'Override MAC address', leave it default.
Just tried it - doesn't work
So you tried putting the MAC Address of the PC or device MAC Address that your ISP has you registered as to negotiate DHCP as under both the ‘Client ID to send when requesting DHCP’ and ‘Vendor Class to send when requesting DHCP’ and used ":" not "-" to separate the octets in the address? Try checking out this solution here https://dev.openwrt.org/ticket/9273
You'll need to know how to SSH in to the router and launch the command 'swconfig dev eth0 set enable_learning 0' which will disable learning for the switch eth0 is on (your WAN, if your WAN is different than eth0 change it to that, i.e. eth1)
If you want to make it permanent you'd want to add 'option enable_learning 0' to /etc/config/network using a text editor, I prefer nano. I think you'd want to add the option either under 'config switch_vlan' under the vlan that uses the WAN port (should be the one where there are the least amount of numbers in 'option ports'.
To install nano you can do it via LUCI or 'opkg update' followed by 'opkg install nano' in a shell. Then just 'nano /etc/config/network' to edit the config file.
Hopefully someday the devs will add an easy way to clone MAC in LUCI. Hopefully this solution works for you. If not, but the 'swconfig dev eth0 set enable_learning 0' try changing the location of the 'option enable_learning 0' in the /etc/network/config file to under 'config interface WAN'.
why you cloning your pc mac address? why not just use macchanger? i made a python script you can run depending on the modem, (cuz first youll have to reboot the modem of course) it changes the mac address via ssh with macchanger, shows the changed mac address then waits for your router to get a new ip, then lists the ip address and logs it to a file. this is based on if you have a bridged modem to router. where your router acquires the ip address rather than the modem.
import requests import paramiko import os import sys import time import random import string import getpass r = requests.session() def randomMac(): return [ 0x00, random.randint(0x00,0x7f), random.randint(0x00,0x7f), random.randint(0x00,0x7f), random.randint(0x00,0xff), random.randint(0x00,0xff)] def Mprettyprint(mac): return ':'.join(map(lambda x: "%02x" % x, mac)) ipadd = raw_input('Enter Ip Address to router:\n') pass = getpass.getpass('Enter Password:\n') def ipchange(): try: f = Mprettyprint(randomMac()) change = f data1 = 'reset_modem=Restart+Cable+Modem' url1 = 'http://192.168.100.1/reset.htm' m = r.post(url1,data1) print m.status_code print '###modem reset###' client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(''+ipadd+'', username='root',password=''+pass+'') stdin, stdout, stderr = client.exec_command("macchanger -bm "+change+" eth0.2") #stdin, stdout, stderr = client.exec_command("macchanger -bA eth0.2") #t = stdout for i in stdout: print i #print t print '###mac changed###' stdin, stdout, stderr = client.exec_command("ifconfig eth0.2 down") stdin, stdout, stderr = client.exec_command("ifconfig eth0.2 up") time.sleep(90) stdin, stdout, stderr = client.exec_command("ifconfig eth0.2") for lines in stdout: print stdout.readline() with open('iplist.txt','a') as file: stdin, stdout, stderr = client.exec_command("ifconfig eth0.2 | grep 'inet addr'") file.write(stdout.readline()) file.close() client.close() print "###Ip Written to List###" t = input('Press Enter to exit') except SyntaxError: sys.exit() ipchange()
just copy and paste this to notepad and save as ipchange.py in whatever directory.
youll have to install the ipk for macchanger via shell(shell you would first do opkg update, then opkg install macchanger, if you dont know what i mean by shell, download a program called putty open it, put in your ip address to your router gateway, like 192.168.1.1 where it says hostname or ip then click open) or luci System>>Software and look under M for macchanger. then install python on your machine windows or linux machine.(make sure to check the part that says "add python to path) then pip install a couple modules..the modules for python youll need are the part of the code that say "import paramiko" etc, so you would do, pip install paramiko requests getpass random, the other modules are already built into python interpretor...i can modify the script based on the type of modem you have, this generally works for most surfboard modems though. you might have to change where it says eth0.2 to whatever interface is your WAN too, if you have questions i can gladly answer them no problem.
P.S or just do it the manual way unplug your modem power, putty into your router run macchanger -bA eth0.2 or eth0 whatever your interface is, youll find the name of your interface under Status>>overview, scroll down to where it says network, then where it says IPv4 WAN Status youll see the interface next to your wan ip address.then ifconfig eth0.2 down, then ifconig eth0.2 up,(again those commands are based off of your wan interface name) in the putty shell, plug the modem back in. and youll acquire a new ip address.