Why does internet get disconnected after I change mac in Kali Linux?
Solution 1
I figured it out (dont know if it works for virtual machines):
$ifconfig eth0 down and/or ifconfig wlan0 down
$service network-manager stop
$macchanger -r eth0 and/or macchanger -r wlan0
$service network-manager restart
note: i dont turn the ifconfig wlan0
or eth0
up, because when you restart the network manager they work, but in case it turn them up manually with ifconfig eth0
up or some jazz like that it doesnt work for me. you can check that both network interfaces work by typing $ifconfig
(you can also see your new random MAC address).
$
- means the coding started
eth0
- network interface
wlan0
- network interface
macchanger - alters the MAC address
ifconfig
- you should know that
Solution 2
It is the equivelant of disabling the inet device like so
$ ifconfig eth0 down
Then changing the hwaddr property to something else and bringing the device back online like so
$ ifconfig eth0 up
Related videos on Youtube
Dr. Debashis De
Updated on September 18, 2022Comments
-
Dr. Debashis De over 1 year
I have written this script to change my mac in Kali Linux:
ifconfig eth0|grep HWaddr ifconfig eth0 down&&macchanger -r eth0&&ifconfig eth0 up ifconfig eth0|grep HWaddr
The problem is each time I do this internet gets disconnected even though I am doing
ifconfig eth0 up
after changing mac. Then I have to go to the double computer icon and open the drop down menu to click on Wired Connection 1 to reconnect to internet. Why is this happening? What command do I need to add to this script to reconnect to internet without using GUI?